Angularjs Examples

AJS Examples


AngularJS Bootstrap Process

AngularJS Bootstrap Process includes from AngularJS initialization to compilation process. AngularJS initialization can be done in two ways, automatic initialization and manual initialization.

Automatic Bootstrap Process

In automatic initialization, AngularJS initializes automatically upon DOMContentLoaded event or when the angular.js script is read if at that time document.readyState is set to 'complete'. At this point Angular looks for the ng-app directive which is root of the AngularJS compilation process. If the ngApp directive is found then Angular will:

  • Load the module associated with the directive.
  • Create the application injector
  • Start compilation of DOM from ng-app directive, the root of the compilation.

Automatic Bootstrap Process Example

See Live Example

Manual Bootstrap Process

Sometimes you may need to manual Initialize AngularJS in order to have more control over the initialization precess. You can do that by calling angular.bootstrap() function inside angular.element(document).ready() function.

The angular.bootstrap() function takes two parameters, the document and module name injector as the second parameter to the angular.bootstrap function.

Manual Bootstrap Process Example

See Live Example