简体   繁体   English

* ngFor循环使用异步管道?

[英]*ngFor loop with async pipe?

Reading through this article and it has an ngFor loop like this: 阅读这篇文章 ,它有一个像这样的ngFor循环:

*ngFor="let contact of contacts | async"

How does the async pipe work in this context? async管道在这种情况下如何工作?

The async pipe gives the latest value from an observable. 异步管道提供来自observable的最新值。 In this case (as in other cases) it will refresh the data involved when a new value comes down the observable. 在这种情况下(如在其他情况下),当新值下降到observable时,它将刷新所涉及的数据。 So if the screen renders and the observable updates the ngFor will re-render. 因此,如果屏幕渲染和可观察的更新,ngFor将重新渲染。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM