简体   繁体   中英

What is ng-app Directive

What is ng-app directive in brief?

I Have tried this ASP.NET MVC 5 With AngularJS - Part One .

The ng-app directive tells AngularJS that this is the root element of the AngularJS application.

All AngularJS applications must have a root element.

You can only have one ng-app directive in your HTML document. If more than one ng-app directive appears, the first appearance will be used.

check this for more info http://www.w3schools.com/angular/ng_ng-app.asp

ng-app is a starting point for the Angular application , also we can say ng-app will be the root element of the app. For better understand

https://docs.angularjs.org/api/ng/directive/ngApp

In order to make your app an Angular app you need to bootstrap AngularJS .

Bootstrapping is the process of intialization ie setting up the dependencies.

This is typically done using the ng-app directive, the bootstrapping can also be done from JavaScript using angular.bootstrap

ng-app directive gives a developer the freedom to make the entire application as an Angular app (writing ng-app on the html element) or only a specific part of the application (such as writing ng-app only on a particular div/container)

When we talk about ng-app directive we sure need to discuss about Modules as well. A module is a container for different parts of your application, A module can depend on other modules and you always have a main module as opposed to having a main method like in a C# Console Application.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM