I use ng-view to switch between views using animation (angular 1.2RC1). To determine the direction the animation should take, I insert the class as slide left or slide right in the ng-view div before invoking my location change. The remaining animation (the first to run) works, but then removes my class from the ng-view div.
I use the service to determine whether to shift left or right to right as follows:
$scope.slideView = function(index, url){ if ( viewSlideIndex.getViewIndex() > index) { $('#slideview') .toggleClass("slide-left", false) .toggleClass("slide-right", true); } else { $('#slideview') .toggleClass("slide-left", true) .toggleClass("slide-right", false); }; $location.url(url); }
which updates the class in the ng-view div:
<button ng-click='slideView(1, "/pg1")'>Pg1</button> <button ng-click='slideView(2, "/pg2")'>Pg2</button> <button ng-click='slideView(3, "/pg3")'>Pg3</button> <div id="slideView" ng-view class="slide-right"></div>
It looks like the slideView (ng-view) classes are already cached and updated after completion, so I'm wondering how to update the cache or change my approach?
Thanks so much for any help.
http://jsfiddle.net/RoryOSiochain/BfJWf/
Manually including a slide left or slide right class in a slide show in the violin works fine.
Update: I hope my use of jQuery above does not confuse the problem using ng-class and jQuery and return the same result / experience.
source share