Skip to content

Commit 27117d1

Browse files
committed
docs(ngInit): clarify when it's okay to use ngInit
Closes angular#10489
1 parent 7c73aaf commit 27117d1

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/ng/directive/ngInit.js

+10-4
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,16 @@
1212
*
1313
* <div class="alert alert-danger">
1414
* This directive can be abused to add unnecessary amounts of logic into your templates.
15-
* There are only a few appropriate uses of `ngInit`, such as for aliasing special properties of
16-
* {@link ng.directive:ngRepeat `ngRepeat`}, as seen in the demo below; and for injecting data via
17-
* server side scripting. Besides these few cases, you should use {@link guide/controller controllers}
18-
* rather than `ngInit` to initialize values on a scope.
15+
* There are only a few appropriate uses of `ngInit`:
16+
* <ul>
17+
* <li>aliasing special properties of {@link ng.directive:ngRepeat `ngRepeat`},
18+
* as seen in the demo below.</li>
19+
* <li>initializing data during development, or for examples, as seen throughout these docs.</li>
20+
* <li>injecting data via server side scripting.</li>
21+
* </ul>
22+
*
23+
* Besides these few cases, you should use {@link guide/component Components} or
24+
* {@link guide/controller Controllers} rather than `ngInit` to initialize values on a scope.
1925
* </div>
2026
*
2127
* <div class="alert alert-warning">

0 commit comments

Comments
 (0)