Reputation: 23
Suppose we have the following code from w3schools:
<script>
var app = angular.module("myShoppingList", []);
app.controller("myCtrl", function($scope) {
$scope.products = ["Milk", "Bread", "Cheese"];
});
</script>
<div ng-app="myShoppingList" ng-controller="myCtrl">
<ul>
<li ng-repeat="x in products">{{x}}</li>
</ul>
</div>
I want to know exactly which functions (from angular.js code) are being called from the very beginning. Is there a way to do that? In other words, if I do not have an HTML file, can I reproduce the effects of angular.js?
I have already used Chrome dev tools, and it did not answer my problem.
Upvotes: 0
Views: 50
Reputation: 48968
From the Docs:
Automatic Initialization
AngularJS initializes automatically upon
DOMContentLoaded
event or when theangular.js
script is evaluated if at that timedocument.readyState
is set to 'complete'. At this point AngularJS looks for thengApp
directive which designates your application root. If thengApp
directive is found then AngularJS will:
- load the module associated with the directive.
- create the application injector
- compile the DOM treating the ngApp directive as the root of the compilation. This allows you to tell it to treat only a portion of the DOM as an AngularJS application.
For more information, see AngularJS Developer Guide - Bootstrap - Automatic Initilization.
Upvotes: 1