AngularJs ng-app

AngularJs ng-app directive : AngularJs ng-app directive is used to define the root of the application. It is used to initialize the application automatically when the page loads

Syntax : AngularJs ng-app

<div ng-app = ''>


Note you can give your ng-app name .


<div ng-app = 'MyApp'>


Let us understand with simple example

Example 1

<!DOCTYPE html>
<html lang="en">
    <script src=""></script>

<div ng-app="" ng-init= "name = 'Tani'">
    <p>Name : <input type='text' ng-model= 'name'></p>
    <p> {{name}}</p>


Try it »


Add Comment

📖 Read More