I've played around with this issue and I've got a suspicion that the problem is associated with setting the ltr
and rtl
classes in $routeChangeStart
. It appears that the ngView animation kicks in before the $routeChangeStart
class interpolation, so while the animation is in progress already $routeChangeStart
changes the classes and all confusion breaks out.
I've got a working example where I moved the ltr
and rtl
change to inside your controller method $scope.goTo
. Ideally you should move this into a separate service. I've also updated your CSS slightly.
.controller('NewCtrl', function ($scope, $location, $rootScope, $route) {
$scope.goTo = function (route) {
var next = $route.routes[route];
$rootScope.viewDirection = 'ltr';
if ($route.current && next && ($route.current.depth > next.depth)) {
$rootScope.viewDirection = 'rtl';
}
$location.path(route);
}
});
The demo: http://plnkr.co/edit/oNcOpoXv8lHtYZETpkCe?p=info