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

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -