多个应用程序会创建多个根范围吗?

Do multiple apps create multiple rootscopes?

如图here, it is possible to add multiple apps to the same page. Also it says in the angularjs documentation

Every application has a single root scope

那么,如果我将两个应用程序映射到页面,那么是否有理由创建两个根范围?

是的,不同的应用程序彼此完全无关,就根范围、模块依赖性、服务、指令、注入器而言

编辑:

为了减轻您的顾虑,这里有一个演示,显示了 2 个应用之间根范围的不平等。 demo搭建大致如下:

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