最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - *ngFor loop with async pipe? - Stack Overflow

programmeradmin7浏览0评论

Reading through this article and it has an ngFor loop like this:

*ngFor="let contact of contacts | async"

How does the async pipe work in this context?

Reading through this article and it has an ngFor loop like this:

*ngFor="let contact of contacts | async"

How does the async pipe work in this context?

Share Improve this question asked Jan 8, 2018 at 23:21 OleOle 47.4k70 gold badges237 silver badges445 bronze badges 1
  • angular.io/api/mon/AsyncPipe. In other words, it tells the ponent to update when a new value is emitted (as opposed to an entire collection upfront) via a RxJS subscription. It also automatically unsubscribes the ponent from the observable when the ponent is destroyed. – ryanlutgen Commented Jan 8, 2018 at 23:25
Add a ment  | 

1 Answer 1

Reset to default 5

The async pipe gives the latest value from an observable. In this case (as in other cases) it will refresh the data involved when a new value es down the observable. So if the screen renders and the observable updates the ngFor will re-render.

发布评论

评论列表(0)

  1. 暂无评论