The ngInit
directive allows you to evaluate an expression in the current scope.
ngInit
: ngRepeat
, as seen in the demo below.ngInit
to initialize values on a scope. ngInit
along with a filter
, make sure you have parentheses to ensure correct operator precedence: <div ng-init="test1 = ($index | toString)"></div>
<ANY ng-init="expression"> ... </ANY>
<ANY class="ng-init: expression;"> ... </ANY>
Param | Type | Details |
---|---|---|
ngInit | expression | Expression to eval. |
© 2010–2020 Google, Inc.
Licensed under the Creative Commons Attribution License 3.0.
https://code.angularjs.org/1.8.2/docs/api/ng/directive/ngInit