-
Notifications
You must be signed in to change notification settings - Fork 27.4k
docs(ngInit): add note on best practices #4366
Conversation
Thanks for the PR!
If you need to make changes to your pull request, you can update the commit with Thanks again for your help! |
Nice one. I never thought of it like that before. I can't think of any other "serious" use of ng-init. It could be worth mentioning that the |
+1 lgtm |
Ha! Nice example for the thing I had to figure a different and not so elegant workaround. |
Landed as e819d21. |
This doesn't feel right. The directive is called I'd suggest to patch the behavior of the directive instead:
For aliasing special property in |
there's no good reason for any of this --- it can already be used like this, and it doesn't make any sense to add breaking changes just to restrict something to a particular use-case that makes sense for one user. This is why I don't think the #5623 is an entirely right-minded idea. It might be nice to build aliasing into ngRepeat (although there is certainly an unreasonable cost to this), but it doesn't make sense to entirely replace a perfectly functional tool with many uses, which is certainly heavily used in demos / reproductions, if not production applications. The idea of restricting something to one particular use-case (which it is already quite capable of serving) does not really add anything particularly helpful, and breaks a lot of things which were already working before |
@caitp Yep, or we can just find a better way to rephrase these lines. |
Adds a note to the docs about acceptable use cases for
ngInit
versus when you should just use a controller.