javascript - How to share data between controller in different modules -
my code includes many modules. each includes service or controller. there main module connect others module.
var app = angular.module('abc', ['ngroute','trancontroller','terminalcontroller','settingcontroller','usercontroller','devicecontroller','sidebar_service'])
but how share data between controller if in different modules. help
there're 2 ways share same data among different controllers of different module, rootscope , factory
example
$rootscope.test = "some value"
rootscope easy initiate of 2 ways, recommend using factory cases. using rootscope might effect whole application, might lead global variable pollution
Comments
Post a Comment