Angular · Junior · Question 23 of 75
What does the async pipe do?
@if (user$ | async; as user) {
<p>{{ user.name }}</p>
}- ✓Correct answer: Subscribes to an Observable or Promise, returns the latest value and unsubscribes on destroy
- 2Makes the template render asynchronously in a Web Worker
- 3Delays rendering by one second
Explanation
The async pipe manages the subscription for you, so there is no manual subscribe/unsubscribe and no memory leak. It also marks the component for check when a new value arrives.