When working with angular components, It's vital to have a better understanding of component life cycle hooks. Angular component life cycle hooks are various call back functions defined inside an angular component class which will be called from angular as callback on different stages of the component.
Starting from ngOnInit to ngOnDestroy these component life cycle hooks enable the developers to plug the logic based on various values initialized or do a cleanup to avoid memory leaks.
In angular components subscribing to various observable is a common need. To unsubscribe those subscriptions before the component gets destroyed we have ngOnDestroy hook.
Official website:
http://www.tutorialpoles.com
Follow us on Twitter:
/ polestutorial
Follow us on Facebook:
/ tutorial-poles-103032308348727
#angular #angular2 #angulartutorial #angular11tutorial