Lifecycle hooks

(Style 09-01)

  • Implement the life cycle hook interfaces. For example:

@Component({
  selector: 'to-hero-button',
  template: `<button>OK</button>`
})
export class HeroButtonComponent implements OnInit {
  ngOnInit() {
    console.log('The component is initialized');
  }
}