Skip to content

AsyncPipe #81

Open
Open
@deepthan

Description

@deepthan

AsyncPipe

官方文档

基本使用方法

{{ obj_expression | async }}

异步管道会监听一个Observable或者promise,并且会使用它返回的最终数据,异步管道使得组件可以对变化进行检测。当组件卸载的时候,异步管道会自动取消监听以避免潜在的内存泄露。

  • 例子
 greeting: Promise<string>|null = null;
 
 private resolve: Function|null = null;
 
this.greeting = new Promise<string>((resolve, reject) => { this.resolve = resolve; });
 <span> {{ greeting | async }}</span>

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions