diff options
Diffstat (limited to 'src/Angular.js')
| -rw-r--r-- | src/Angular.js | 44 |
1 files changed, 28 insertions, 16 deletions
diff --git a/src/Angular.js b/src/Angular.js index 797e4b81..8409f971 100644 --- a/src/Angular.js +++ b/src/Angular.js @@ -1102,26 +1102,38 @@ function encodeUriQuery(val, pctEncodeSpaces) { * * @description * - * Use this directive to auto-bootstrap an application. Only - * one ngApp directive can be used per HTML document. The directive - * designates the root of the application and is typically placed - * at the root of the page. + * Use this directive to **auto-bootstrap** an AngularJS application. The `ngApp` directive + * designates the **root element** of the application and is typically placed near the root element + * of the page - e.g. on the `<body>` or `<html>` tags. * - * The first ngApp found in the document will be auto-bootstrapped. To use multiple applications in - * an HTML document you must manually bootstrap them using {@link angular.bootstrap}. - * Applications cannot be nested. + * Only one AngularJS application can be auto-bootstrapped per HTML document. The first `ngApp` + * found in the document will be used to define the root element to auto-bootstrap as an + * application. To run multiple applications in an HTML document you must manually bootstrap them using + * {@link angular.bootstrap} instead. AngularJS applications cannot be nested within each other. * - * In the example below if the `ngApp` directive were not placed - * on the `html` element then the document would not be compiled - * and the `{{ 1+2 }}` would not be resolved to `3`. + * You can specify an **AngularJS module** to be used as the root module for the application. This + * module will be loaded into the {@link AUTO.$injector} when the application is bootstrapped and + * should contain the application code needed or have dependencies on other modules that will + * contain the code. See {@link angular.module} for more information. * - * `ngApp` is the easiest way to bootstrap an application. + * In the example below if the `ngApp` directive were not placed on the `html` element then the + * document would not be compiled, the `AppController` would not be instantiated and the `{{ a+b }}` + * would not be resolved to `3`. * - <doc:example> - <doc:source> - I can add: 1 + 2 = {{ 1+2 }} - </doc:source> - </doc:example> + * `ngApp` is the easiest, and most common, way to bootstrap an application. + * + <example module="ngAppDemo"> + <file name="index.html"> + <div ng-controller="ngAppDemoController"> + I can add: {{a}} + {{b}} = {{ a+b }} + </file> + <file name="script.js"> + angular.module('ngAppDemo', []).controller('ngAppDemoController', function($scope) { + $scope.a = 1; + $scope.b = 2; + }); + </file> + </example> * */ function angularInit(element, bootstrap) { |
