Menu ▼

ng-app directive in AngularJS

In AngularJS, ng-app directive is used as root element (like <html>, <body> tags) of the application, when ng-app directive is used then the application will be recognized as AngularJS application.

When ng-app directive is used then it auto bootstrap an AngularJS application and only one AngularJS application can be auto-bootstrapped in a webpage. The first ng-app directive found in the page will be treated as root element and bootstrapped automatically. If an HTML document contains multiple multiple AngularJS(ng-app) applications then the remaining have to be bootstrapped manually.

One AngularJS application can not be placed inside another application, i.e. AngularJS applications cannot be nested within each other.

<body ng-app="">
Using directive by giving a name
<body ng-app="sampleApp">

We will discuss more about using ng-app directive by giving a name in coming articles.

Multiplicaiton of 2 X 10 = {{ 2*10 }}

Soruce code:
<html xmlns="">
    <script src=""></script>
<body ng-app="">
Multiplicaiton of 2 X 10 = {{ 2*10 }}