I'm new to Angular 2. Why is ngOnInit
not the first hook that is called after the constructor of a component or directive?
Source: https://angular.io/docs/ts/latest/guide/lifecycle-hooks.html
ngOnInit()
is called after ngOnChanges()
was called the first time.
This ensures that initial values bound to inputs are available when ngOnInit()
is called. ngOnChanges()
is called after inputs were updated.
There were quite some discussions about the order of the first ngOnChanges()
and ngOnInit()
but none of the arguments were considered strong enough to change anything.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With