Important Parts in Angular 6 - will be updated.
OnDestroy() Unsubscribe from Observables and DOM events. Stop interval timers. Unregister all callbacks that this directive registered with global or application services. You risk memory leaks if you neglect to do so. EventEmitter Here are the pertinent excerpts from that HeroDetailComponent : src/app/hero-detail.component.ts (template) template : ` <div> <img src="{{heroImageUrl}}"> <span [style.text-decoration]="lineThrough"> {{prefix}} {{hero?.name}} </span> <button (click)="delete()"> Delete </button> </div>` src/app/hero-detail.component.ts (deleteRequest) // This component makes a request but it can't actually delete a hero. deleteRequest = new EventEmitter < Hero >(); delete () { this . deleteRequest . emit ( this . hero ); } The component defines a deleteRequest property that returns an EventEmitter . When the user clicks delete , the component invokes t...