Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit a4c3b06

Browse files
docs(guide/bootstrap): clarify manual bootstrapping
1 parent 86f3e41 commit a4c3b06

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

docs/content/guide/bootstrap.ngdoc

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@
77
This page explains the Angular initialization process and how you can manually initialize Angular
88
if necessary.
99

10-
11-
# Angular `<script>` Tag
10+
## Angular `<script>` Tag
1211

1312
This example shows the recommended path for integrating Angular with what we call automatic
1413
initialization.
@@ -50,7 +49,7 @@ initialization.
5049

5150

5251

53-
# Automatic Initialization
52+
## Automatic Initialization
5453

5554
Angular initializes automatically upon `DOMContentLoaded` event or when the `angular.js` script is
5655
evaluated if at that time `document.readyState` is set to `'complete'`. At this point Angular looks
@@ -76,16 +75,14 @@ If the {@link api/ng.directive:ngApp `ng-app`} directive is found then Angular w
7675

7776

7877

79-
# Manual Initialization
78+
## Manual Initialization
8079

8180

8281
If you need to have more control over the initialization process, you can use a manual
8382
bootstrapping method instead. Examples of when you'd need to do this include using script loaders
8483
or the need to perform an operation before Angular compiles a page.
8584

86-
87-
Here is an example of manually initializing Angular. The example is equivalent to using the {@link
88-
api/ng.directive:ngApp ng-app} directive.
85+
Here is an example of manually initializing Angular:
8986

9087
<pre>
9188
<!doctype html>
@@ -95,17 +92,22 @@ api/ng.directive:ngApp ng-app} directive.
9592
<script src="http://code.angularjs.org/angular.js"></script>
9693
<script>
9794
angular.element(document).ready(function() {
98-
angular.bootstrap(document);
95+
angular.bootstrap(document, ['optionalModuleName']);
9996
});
10097
</script>
10198
</body>
10299
</html>
103100
</pre>
104101

102+
Note that we have provided the name of our application module to be loaded into the injector as the second
103+
parameter of the {@link api/angular.bootstrap} function. This example is equivalent to using the
104+
{@link api/ng.directive:ngApp ng-app} directive, with `ng-app="optionalModuleName"`, as in the automatic
105+
initialization example above.
106+
105107
This is the sequence that your code should follow:
106108

107-
1. After the page and all of the code is loaded, find the root of the HTML template, which is
108-
typically the root of the document.
109+
1. After the page and all of the code is loaded, find the root element of your AngularJS
110+
application, which is typically the root of the document.
109111

110-
2. Call {@link api/angular.bootstrap} to {@link compiler compile} the template into an
112+
2. Call {@link api/angular.bootstrap} to {@link compiler compile} the element into an
111113
executable, bi-directionally bound application.

0 commit comments

Comments
 (0)