Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AsyncPipe #81

Open
deepthan opened this issue Aug 13, 2020 · 0 comments
Open

AsyncPipe #81

deepthan opened this issue Aug 13, 2020 · 0 comments

Comments

@deepthan
Copy link
Owner

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant