I have template (that is not defined by router), where I have 2 links (anchors), which changes variable
<a ng-href="#/service/service1"
ng-click="activeService='minecraft'">
And then I have 2 images - their class depends on the variable set by ng-click
ng-class="activeService != 'none' ? { true: 'service-maximize-animate', false: 'service-minimize-animate'}[activeService=='service1'] : ''"
This works perfectly. But when I press back button in browser or change URL address directly, route changes, ng-view
updates, BUT the images (in global template that is not set by router) don't update (they are not in ng-view
(the template))
And here I face the problem - I have to use controller
, but I can't use controller
by router, because it's scope is only for the template (ng-view
).
I also tried to use ng-controller
, but it is not called, when route changes.
Is there any way, to solve it?
Also, I would like to know if there is any way to make the ng-view
better readable, now it's horrible :)
Thanks, Michal Hojgr
EDIT: jsfiddle: http://jsfiddle.net/5rzGU/9/