- ng-app directive defines the root element to initializes an AngularJS application.
- ng-app directive is commonly allocated nearby the root element of the HTML page. For example, on the <body> or <html> tags.
- We can declare in any HTML elements like <div>, <body> etc…where ever it is declared it is the owner of the Angularjs application.
- ng-app directive, which is used to bootstrap/loads itself and it will compile the HTML template(auto-bootstrapped/loads) in AngularJS application.
- The html document is auto-bootstrapped by only using AngularJS application.
Syntax for ng-app in AngularJS:
Parameter Values for ng-app in AngularJS:
||Defines the module name to load with the application. It’s an Optional.
Sample Coding for ng-app in AngularJS:
ng-app directive declaration in AngularJS:
The ng-app defined inside the <body>tag. Hence<body> tag become the root element of AngularJS application.
Code Explanation for ng-app in AngularJS:
- The ng-app defined inside the <body>tag. Hence<body> tag become the root element of AngularJS application.
- AngularJS will resolve the expression and it will return the result.
- The entered text “Wikitechy” will be displayed here.
Related Searches to angularjs ng-app directive
ng app multiple modules
ng-app vs ng-controller
ng-app not working
what is ng-model in angularjs
ng-controller in angularjs
angularjs multiple modules example