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:
- constructor
- ngOnChanges
- ngOnInit
- ngAfterViewInit
- ngOnDestroy