javascriptangularjsng-app

One single webpage to have 1 ng-app or multiple webpages to share same ng-app?


I am using angularjs 1.4

I would like to have 2 web pages for my web application. 1 web page for log-in and another web page for the main app. If user logs in correctly, he will be re-directed to the web page for the main app.

I am not sure which is a better design for angularjs. Should I use 1 ng-app for one webpage or should I use the same ng-app for the 2 web pages? Which approach is better for angularjs? Or doesn't matter?


Solution

  • I don't think there is a right or wrong answer here.

    In my opinion:

    1. If I have a large application that has a couple of large components - then I like splitting them up into separate applications.

    2. If you have a small application with 2 pages then I guess this should be in the same single page application.

    3. If you have a master page and you don't want any reloads or glitches - then this must be in one single page application.