AngularJs Initializing application
Angular initializes the application using ng-app directive.
a) What is ng-app ?
Example :
1) ng-app in HTML tag a) What is ng-app ?
-
It will tell the AngularJS that this is the AngularJs application and the element to which directive is initialized is root
element of the application.
-
It is set in the index.html page of
application directory where the <html> </html> tags
starts or in the <body></body> element.
-
Only one ng-app directive can be initialized to an element, if more
than one is initialized then the first occurrence will set as the root element.
-
When the AngularJs library loads it
will check the ng-app directive and set the $rootScope to the element where the ng-app is initialized.
Example :
2) ng-app in the body tag
Code Explanation : "store" is the name of the app. you need to use the app name in your entire application.
For ex:
store.controller('LoginController', function() { });
store.filter('HTMLparser', function() { });