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:
Tyler McGinnis 2013-10-14 09:47:19 -07:00 committed by Pete Bacon Darwin
parent 261057db9b
commit bf29cbc53f

View file

@ -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