Umesh  kumar
What is the use on onDestroy in Angular?
By Umesh kumar in Angular on May 24 2021
  • Pranam Bhat
    May, 2021 25

    onDestroy() is a lifecycle hook that is called when a directive, pipe or service is destroyed.When an Angular component is destroyed, the ngOnDestroy life cycle method is called so we can clean up long-running tasks or unsubscribe from any RxJS Observables. Angular Services also have an ngOnDestroy method, just like Angular components. This lifecycle can be helpful when we create and destroy services that need to run some cleanup work when the component is destroyed.ngOnDestroy() {this.data.unsubscribe(); }

    • 0

Most Popular Job Functions


MOST LIKED QUESTIONS

var $j = jQuery.noConflict();