The Async Pipe in Angular 2 can reduce boilerplate and mental overhead when dealing with observables and promises. This lesson explores how the Async Pipe works, the code it eliminates, and demonstrates common use-cases within your applications!
Hello, thanks for watching. In TypeScript you will just call .subscribe on the observable. Behind the scenes the AsynPipe is just subscribing to the observable, keeping track of the last emitted value, and triggering change detection when this value changes. It also makes sure to clean up the subscription when the component is destroyed, this is equivalent to calling unsubscribe in ngOnDestroy. Hope this helps, let me know if you have any other questions! :)