Question:What is auto bootstrap process in AngularJS? OR How AngularJS is initialized automatically? 

Answer Angular initializes automatically upon DOMContentLoaded event or when the angular.js script is downloaded to the browser and the document.readyState is set to complete. At this point AngularJS looks for the ng-app directive which is the root of angular app compilation and tells about AngularJS part within DOM. When the ng-app directive is found then Angular will: 1. Load the module associated with the directive. 2. Create the application injector. 3. Compile the DOM starting from the ng-app root element. This process is called auto-bootstrapping. Example
<html> 
 <body ng-app="myApp"> 
   <div ng-controller="Ctrl"> Hello {{msg}}! </div> 

  <script src="lib/angular.js"></script> 
 <script> 
   var app = angular.module('myApp', []); 
   app.controller('Ctrl', function ($scope) { $scope.msg = 'World'; }); 
 </script> 
/body> 
</html>
 

+ Report
Total Preview: 1096
What is auto bootstrap process in AngularJS? OR How AngularJS is initialized automatically?
Copyright © 2024. Powered by Intellect Software Ltd
  /body>   ","http://vcampusbd.com/answers/19149/what-is-auto-bootstrap-process-in-angularjs-or-how-initialized-automatically","http://vcampusbd.com/images/vcampus_quiz.jpg","AngularJS"); }); });