Answer the question
In order to leave comments, you need to log in
Why doesn't Angular's async pipe work with a getter that returns a Promise?
Why doesn't Angular's async pipe work with a getter that returns a Promise?
.ts component:
get user(): Promise<string> {
//метод возвращающий промис
return getCurrentUser();
}
<p>{{ user | async }}</p>
user | async
Answer the question
In order to leave comments, you need to log in
If you do this, then for each check of the change, Angular will start the promise again. If you have a network request, check that you do not have a million canceled requests there.
It would be necessary not through a getter, but to transfer a promise to a variable.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question