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

smartface.io - Proper way to change color scheme for whole application -

Email notification in google apps script -

javascript - three.js lot of meshes optimization -