Why is ngOnInit not the first lifecycle hook?

I am new to Angular 2. Why ngOnInitnot the first hook to be called after the constructor of a component or directive?

Source: https://angular.io/docs/ts/latest/guide/lifecycle-hooks.html

enter image description here

+4
source share
1 answer

ngOnInit()called after it ngOnChanges()was called for the first time.

This ensures that the initial values ​​associated with the inputs are available when called ngOnInit(). ngOnChanges()called after updating inputs.

ngOnChanges() ngOnInit(), , - .

+3

Source: https://habr.com/ru/post/1658770/


All Articles