View source Improve this doc

ngApp
directive in module ng

Description

Use this directive to auto-bootstrap an application. Only one ngApp directive can be used per HTML document. The directive designates the root of the application and is typically placed at the root of the page.

The first ngApp found in the document will be auto-bootstrapped. To use multiple applications in an HTML document you must manually bootstrap them using angular.bootstrap. Applications cannot be nested.

In the example below if the ngApp directive would not be placed on the html element then the document would not be compiled and the {{ 1+2 }} would not be resolved to 3.

ngApp is the easiest way to bootstrap an application.

Source



Demo

Usage

as attribute
<ANY ng-app="{angular.Module}">
   ...
</ANY>
as class
<ANY class="ng-app: {angular.Module};">
   ...
</ANY>

Parameters

ParamTypeDetails
ngAppangular.Module

an optional application module name to load.