This repository was archived by the owner on Apr 12, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change 1010 * current scope.
1111 *
1212 * <div class="alert alert-danger">
13- * The only appropriate use of `ngInit` is for aliasing special properties of
14- * {@link ng.directive:ngRepeat `ngRepeat`}, as seen in the demo below. Besides this case, you
15- * should use {@link guide/controller controllers} rather than `ngInit`
16- * to initialize values on a scope.
13+ * This directive can be abused to add unnecesary amounts of logic into your templates.
14+ * There are only a few appropriate uses of `ngInit`, such as for aliasing special properties of
15+ * {@link ng.directive:ngRepeat `ngRepeat`}, as seen in the demo below; and for injecting data via
16+ * server side scripting. Besides these few cases, you should use {@link guide/controller controllers}
17+ * rather than `ngInit` to initialize values on a scope.
1718 * </div>
19+ *
1820 * <div class="alert alert-warning">
19- * **Note**: If you have assignment in `ngInit` along with {@link ng.$filter `$ filter`}, make
20- * sure you have parenthesis for correct precedence:
21+ * **Note**: If you have assignment in `ngInit` along with a {@link ng.$filter `filter`}, make
22+ * sure you have parentheses to ensure correct operator precedence:
2123 * <pre class="prettyprint">
22- * `<div ng-init="test1 = (data | orderBy:'name' )"></div>`
24+ * `<div ng-init="test1 = ($index | toString )"></div>`
2325 * </pre>
2426 * </div>
2527 *
You can’t perform that action at this time.
0 commit comments