Put in order · Angular course · Module 2: Components

Lifecycle Hooks Order

Arrange the lifecycle hooks in the order Angular calls them (from first to last):

Items to put in order

  • ngOnDestroy
  • ngOnChanges
  • ngOnInit
  • constructor
  • ngAfterViewInit
Show the answer

Correct order:

  1. constructor
  2. ngOnChanges
  3. ngOnInit
  4. ngAfterViewInit
  5. ngOnDestroy