angularjs - Controller running Parse query before scope variable resolved -


i have dashboard has variable x needed throughout application. have factory in dashboard.js listens x's value change , updates if needed. dashboard.js runs first , resolves x. there several pages have own controllers load after dashboard.js. these pages listen/use variable x. running parse queries in controllers of these pages x showing undefined cannot use in query. how run controller after x defined?

assuming relationship between controllers parent-child relationship , variable declared on $scope, childcontrollers should inherit variable. without code , hard tell.

either way, use $rootscope make variable accessible. eventhough technically possible , not way want it.

then have possibility broadcast/emit , watch , event x changes. can transmit data on event. doing, guess?

you create service injected in every controller, regardless of relation, keeps track of variable. or in case, assign functionality factory too.

but hard tell without code you're trying do.


Comments

Popular posts from this blog

PHP DOM loadHTML() method unusual warning -

python - How to create jsonb index using GIN on SQLAlchemy? -

c# - TransactionScope not rolling back although no complete() is called -