Reputation: 51
we can write ng-app
in any html tag.
But what is the difference if we write it in <html>
or <body>
or <head>
.
Please help me out.
Upvotes: 0
Views: 482
Reputation: 25352
Wherever you put ng-app
it doesn't matter.
ng-app
enables angular environment within it's block.
like if you use ng-app
in head
tag then it'll enable angular environment within it's </head>
tag.
Like this
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
<div>
<div ng-app>
{{4+5}} <!-- inside of ng-app block -->
</div>
<div>
{{4+5}} <!-- outside of ng-app block -->
</div>
</div>
Upvotes: 3
Reputation: 1384
Bootstrapping of your application begins from the element where you declare the attribute
data-ng-app
Upvotes: 0