Improve this Doc View Source ngInit
- directive in module ng
ngInit directive allows you to evaluate an expression in the current scope.
ngInit, such as for aliasing special properties of
ngRepeat, as seen in the demo below; and for injecting data via server side scripting. Besides these few cases, you should use controllers rather than
ngInitto initialize values on a scope.
ngInitalong with a
filter, make sure you have parentheses to ensure correct operator precedence:
<div ng-init="test1 = ($index | toString)"></div>
- This directive executes at priority level 450.
- as attribute:
<ANY ng-init="expression"> ... </ANY>
- as CSS class:
<ANY class="ng-init: expression;"> ... </ANY>
|ngInit|| || |
Expression to eval.
© 2010–2017 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.