Angular · Middle · Question 6 of 75
Which is the best way to display data from an Observable in an OnPush component?
- ✓Correct answer: The
asyncpipe ortoSignal(), both of which update the view correctly - 2Subscribe in the constructor and assign the value to a plain field
- 3Call
.subscribe()directly in the template
Explanation
A manual subscription assigning a plain field won't be picked up by OnPush without markForCheck, and it also needs manual cleanup. async and toSignal handle both concerns.