ng-animate : conditionally switching “back” transition (BUG?)

亡梦爱人 提交于 2019-12-01 08:54:19

Ok, so based on the comments I'm pretty sure you want the incoming page to also determine exit animations to apply to the outgoing page. So you really need your $locationChange code.

It also looks like the problem you are seeing is that you are setting a class on the parent independently on the incoming page but there is nothing to keep the animations waiting for this class change to occur.

The simplest fix seems to be to make the ng-animate depend on your changing variable to determine the animation class names:

<ng-view ng-animate="transitionClass"></ng-view>

then the CSS selectors just collapse into single classes:

.LR-enter-active {
  ...
}

(where transitionClass is still being set on the $rootScope in the locationChangeStart:)

 $rootScope.$on("$locationChangeStart", function (event, next, current) {
 ...

http://jsfiddle.net/9XPVX/4/

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!