From 944098a4e0f753f06b40c73ca3e79991cec6c2e2 Mon Sep 17 00:00:00 2001 From: Brad Green Date: Tue, 27 Mar 2012 18:06:00 -0700 Subject: Updated manual bootstrap document Explained why you'd want to manually bootstrap, added contrasting example for automatic vs manual methods. --- .../dev_guide.bootstrap.manual_bootstrap.ngdoc | 37 ++++++++++++---------- 1 file 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: + +
+ + + + +... +@@ -21,19 +34,9 @@ explicitly. }); - -Hello {{'World'}}! - - +... -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 -- cgit v1.2.3