What it does
Unwraps a value from an asynchronous primitive.
How to use
observable_or_promise_expression | async
NgModule
Description
The async
pipe subscribes to an Observable
or Promise
and returns the latest value it has
emitted. When a new value is emitted, the async
pipe marks the component to be checked for
changes. When the component gets destroyed, the async
pipe unsubscribes automatically to avoid
potential memory leaks.
Examples
This example binds a Promise
to the view. Clicking the Resolve
button resolves the
promise.
It's also possible to use async
with Observables. The example below binds the time
Observable
to the view. The Observable continuously updates the view with the current time.
exported from common/index defined in common/src/pipes/async_pipe.ts