docs(ngInit): relaxed the warning notice · angular/angular.js@010d9b6 (original) (raw)

This repository was archived by the owner on Apr 12, 2024. It is now read-only.

File tree

1 file changed

lines changed

1 file changed

lines changed

Original file line number Diff line number Diff line change
@@ -10,16 +10,18 @@
10 10 * current scope.
11 11 *
12 12 *
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.
17 18 *
19 + *
18 20 *
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:
21 23 *
22 - * `
`
24 + * `
`
23 25 *
24 26 *
25 27 *