diff options
| author | Tyler McGinnis | 2013-10-14 09:47:19 -0700 |
|---|---|---|
| committer | Pete Bacon Darwin | 2013-10-24 20:42:02 +0100 |
| commit | bf29cbc53f585c4dd2455b57ebfa18063dc17f6a (patch) | |
| tree | 21a41fbd5062a918ba6adacc80e0fefd67cb51b5 | |
| parent | 261057db9bdded43e10c2b778dff14d2acbe8416 (diff) | |
| download | angular.js-bf29cbc53f585c4dd2455b57ebfa18063dc17f6a.tar.bz2 | |
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
| -rw-r--r-- | src/ng/directive/ngController.js | 5 |
1 files changed, 4 insertions, 1 deletions
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 |
