Sunday, July 16, 2017

What is ng-app directive?

It is represent angular JS application and root element of the application. It initializes the angular JS framework automatically. It will first check the ng-app directive in HTML document if it is found then complete document is loaded.

Example:




 Output:

In above example, ng-app directive is placed in the div element whose id div_Id.Therefor, AngularJs will only compile div_Id and its child element. It will not compile the parent or sibling elements of div_Id.

The following figure illustrates the above example.




No comments:

Post a Comment