the documentation for migration from angularjs 1.5 to 1.6 says "Disabling (by default) the pre-assignment of bindings on controller instances, which helps with support for native ES6 classes." and "Initialization logic that relies on bindings being present should be put in the controller's $onInit() method, which is guaranteed to always be called after the bindings have been assigned."
I try to do this migration for our project and I observed, that for some of the controllers $onInit doesn't get called. In the official documentation I didn't find anything related to this, but there are some other sources:
https://www.tejusparikh.com/2017/universality-oninit-callback-angularjs.html
https://github.com/angular/angular.js/issues/14630
Are there other cases when the $onInit doesn't get called? Is this documented somewhere "more officially"?
Thank you!
I have also found that controllers Initialized by ngRoute, $onInit is not called.
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