diff options
| author | Brad Green | 2012-03-27 18:06:00 -0700 | 
|---|---|---|
| committer | Brad Green | 2012-03-27 18:06:00 -0700 | 
| commit | 944098a4e0f753f06b40c73ca3e79991cec6c2e2 (patch) | |
| tree | 0d69a70998ed388be51a810c7a6581b52445ee0d | |
| parent | 2ce0485e6f21c77e84fd4fc07a9b15adc90a7fd8 (diff) | |
| download | angular.js-944098a4e0f753f06b40c73ca3e79991cec6c2e2.tar.bz2 | |
Updated manual bootstrap document
Explained why you'd want to manually bootstrap, added contrasting
example for automatic vs manual methods.
| -rw-r--r-- | docs/content/guide/dev_guide.bootstrap.manual_bootstrap.ngdoc | 37 | 
1 files changed, 20 insertions, 17 deletions
| diff --git a/docs/content/guide/dev_guide.bootstrap.manual_bootstrap.ngdoc b/docs/content/guide/dev_guide.bootstrap.manual_bootstrap.ngdoc index e952e91e..9f6464b2 100644 --- a/docs/content/guide/dev_guide.bootstrap.manual_bootstrap.ngdoc +++ b/docs/content/guide/dev_guide.bootstrap.manual_bootstrap.ngdoc @@ -2,13 +2,26 @@  @name  Developer Guide: Initializing Angular: Manual Initialization  @description -Letting angular handle the initialization process (bootstrapping) is a handy way to start using -angular, but advanced users who want more control over the initialization process can choose to use -the manual bootstrapping method instead. +In the vast majority of cases you'll want to let Angular handle initialization automatically.   +If, however, you need to delay Angular from managing the page right after the DOMContentLoaded  +event fires, you'll need to control this initialization manually. -The best way to get started with manual bootstrapping is to look at the what happens when you use -{@link api/angular.module.ng.$compileProvider.directive.ng-app ng-app}, by showing each step of the process -explicitly. +To initialize Angular -- after you've done your own special-purpose initialization -- just call  +the {@link api/angular.bootstrap bootstrap()} function with the HTML container node that you want +Angular to manage.  In automatic initialization you'd do this by adding the `ng-app` attribute to  +the same node.  Now, you won't use `ng-app` anywhere in your document. + +To show the contrast of manual vs. automatic initialization, this automatic method: + +<pre> +<!doctype html> +<html ng-app> +<head> +  <script src="http://code.angularjs.org/angular.js"></script> +... +</pre + +is the same as this manual method:  <pre>  <!doctype html> @@ -21,19 +34,9 @@ explicitly.       });    </script>  </head> -<body> -Hello {{'World'}}! -</body> -</html> +...  </pre> -This is the sequence that your code should follow if you bootstrap angular on your own: - -1. After the page is loaded, find the root of the HTML template, which is typically the root of -the document. -2. Call {@link api/angular.bootstrap} to  {@link dev_guide.compiler compile} the template into -an executable, bi-directionally bound application. -  ## Related Topics | 
