angular-component-life-cycle
Angular / RxJS Cuándo debo cancelar la suscripción
¿Cuándo debo almacenar las instancias Subscription e invocar unsubscribe() durante el ciclo de vida de ngOnDestroy y cuándo ... umber
this.service.getHero(id).then(hero => this.hero = hero);
});
}
ngOnDestroy() {
this.sub.unsubscribe();
}