From bf29cbc53f585c4dd2455b57ebfa18063dc17f6a Mon Sep 17 00:00:00 2001 From: Tyler McGinnis Date: Mon, 14 Oct 2013 09:47:19 -0700 Subject: 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 --- src/ng/directive/ngController.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/ng/directive') diff --git a/src/ng/directive/ngController.js b/src/ng/directive/ngController.js index 7ee7648f..6a7b8f03 100644 --- a/src/ng/directive/ngController.js +++ b/src/ng/directive/ngController.js @@ -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 -- cgit v1.2.3