0

As shown here, it is possible to add multiple apps to the same page. Also it says in the angularjs documentation that

Every application has a single root scope

Then does it stand to reason that there are two rootscopes created if I map two apps to the page ?

Community
  • 1
  • 1
user96551
  • 185
  • 11

1 Answers1

0

Yes, different apps are completely unrelated to each other, with respect to root scope, modules dependencies, services, directives, injectors

EDIT:

To ease your concerns, here's a demo that shows inequality of root scopes between 2 apps. The demo is built roughly as follows:

var comparator = {
   set: function(key, obj){
     // set object with some key
   },
   compare: function(key1, key2){
     // console.log of previously-set objects with keys key1 and key2
   }
}

var app1 = angular.module("app1", [])
  .run(function($rootScope){
    comparator.set("rootScope1", $rootScope);
  });

var app2 = angular.module("app2", [])
  .run(function($rootScope){
    comparator.set("rootScope2", $rootScope);
  });

Demo

New Dev
  • 48,427
  • 12
  • 87
  • 129