X Tutup
Skip to content

Commit 7eb15c4

Browse files
docs(guide/bootstrap): clarify manual bootstrapping
1 parent 1fac36e commit 7eb15c4

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, at which point Angular looks for
5655
the {@link api/ng.directive:ngApp `ng-app`} directive which
@@ -77,16 +76,14 @@ will:
7776

7877

7978

80-
# Manual Initialization
79+
## Manual Initialization
8180

8281

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

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

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

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

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

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

0 commit comments

Comments
 (0)
X Tutup