From Angular docs regarding ng-init:
This directive may be abused to add unnecessary amounts of logic to your templates. There are only a few suitable uses of ngInit, such as for smoothing the special properties of ngRepeat, as seen in the demo below; and for entering data through server scripts.
Can someone explain the second use case:
... and for entering data through scripts on the server side.
In particular, would it be advisable to use this directive to pass a value (for example, a model identifier) from a Rails / PHP view to an Angular controller?
Other methods (using $ location) seem unnecessarily complicated.
source
share