Two different animations for route changes

后端 未结 5 1613
感动是毒
感动是毒 2020-12-28 15:51

I have the following case: I\'m using the ui-router for the routing in my AngularJS application. In one route, there are five child states for different subscreens. I want t

5条回答
  •  天命终不由人
    2020-12-28 16:39

    Eddiec's solution was a really nice start but I still found myself hacking it up a bit. Here is a modified controller that works better for my purposes. This is more dynamic:

    function ViewCtrl($scope, $state) {
    
       $scope.$on('$stateChangeStart', function (event, toState) {
            var movingToParent = $state.includes(toState.name);
            if (movingToParent) {
                $scope.back = true; 
            } else {
                $scope.back = false; 
            }
        });
    
    
    }
    

提交回复
热议问题