For the last few weeks, I've been immersing myself in AngularJS, studying large-scale applications to gain insights into real-world development practices. One common pattern I observed is the use of ng-init="init()"
when loading a view - essentially calling the init() function within the controller to set initial values.
However, delving deeper into the Angular docs, I encountered a rather strict statement about ngInit:
"The only recommended usage of ngInit is for aliasing special properties of ngRepeat. In other cases, it's best practice to utilize controllers instead of ngInit for initializing scope values."
This led me to ponder: Is it considered poor practice to employ ngInit for value initialization upon view load? And why is this so? What would be the appropriate approach?"