Data from factory are not synchronized between view (tabs)


#1

Hi,

I have a strange trouble. I have three tabs, each has the “state rule” in ui-router. On the first tab I have three toggles; when they change the value, I call function setToggleA() which stores actual value on factory variable. When first enter other tab, the data are synchronized (via ui-router resolve, getToggleA() function).

The problem is, when enter the firs tab and change the toggle, and enter the other tab, the data are NOT synchronized unless click the button for manual synchronization - getToggleA() function.

I do NOT use $scope, use controller AS syntax. But am supprised where is the problem.

So: using “resolve method”, the data ARE synchronized from factory when FIRST enter other tab. It works. Same when I manually click the button to sync data from factory. It works. But automatic synchronization from the factory to the another tab (controller) does NOT work.


#2

There was my fault in the code, I am not sure exactly where and why. Now everything works like a charm.

Problem solved with the help in: http://plnkr.co/edit/zq6VGOWoRRTrCnF7Rnf2?p=preview