mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-03-17 07:40:22 +00:00
docs(ngController): do not attach a controller twice
A common mistake for beginners is to attach a controller in both the $routeProvider and also in the html document using the ng-controller directive. This change highlights this, to help prevent developers from doing so in the future. Closes #4409
This commit is contained in:
parent
261057db9b
commit
bf29cbc53f
1 changed files with 4 additions and 1 deletions
|
|
@ -16,7 +16,10 @@
|
|||
* * Controller — The `ngController` directive specifies a Controller class; the class contains business
|
||||
* logic behind the application to decorate the scope with functions and values
|
||||
*
|
||||
* Note that an alternative way to define controllers is via the {@link ngRoute.$route $route} service.
|
||||
* Note that you can also attach controllers to the DOM by declaring it in a route definition
|
||||
* via the {@link ngRoute.$route $route} service. A common mistake is to declare the controller
|
||||
* again using `ng-controller` in the template itself. This will cause the controller to be attached
|
||||
* and executed twice.
|
||||
*
|
||||
* @element ANY
|
||||
* @scope
|
||||
|
|
|
|||
Loading…
Reference in a new issue