angularjs - Do multiple apps create multiple rootscopes? -


as shown here, possible add multiple apps same page. says in angularjs documentation

every application has single root scope

then stand reason there 2 rootscopes created if map 2 apps page ?

yes, different apps unrelated each other, respect root scope, modules dependencies, services, directives, injectors

edit:

to ease concerns, here's demo shows inequality of root scopes between 2 apps. demo built follows:

var comparator = {    set: function(key, obj){      // set object key    },    compare: function(key1, key2){      // console.log of previously-set objects keys key1 , 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


Comments

Popular posts from this blog

node.js - Using Node without global install -

How to access a php class file from PHPFox framework into javascript code written in simple HTML file? -

java - Null response to php query in android, even though php works properly -