-1

I am new to angular. Shoud I use the same ng-app throughout the site or should I use different ng-app directives for different pages?

henrikmerlander
  • 1,554
  • 13
  • 20
Piyush Jain
  • 1,895
  • 3
  • 19
  • 40

2 Answers2

0

Use one app for your app, and use different controllers for each page. So put ng-app in html-tag.

<html ng-app="myApp">....
aup
  • 800
  • 7
  • 19
0

Angular is a good framework for Single Page Application so you should use just one declaration of "ng-app" inside a single page and load Partial Views with other directives such as "ng-include", "ng-view", "ui-view", etc... for portions of html inside the body tag with one controller per each of these.

German Blanco
  • 816
  • 6
  • 9
  • Hi,Thanks for your help. Also Want to know does it matter that if I use ng-app or I use id="myApp" and then bootstrap this app ?? – Piyush Jain Mar 18 '16 at 07:04