【发布时间】:2013-12-04 05:16:32
【问题描述】:
我有一个带有<div> 的AngularJS 1.2.2 Web 应用程序,我根据一些$scope 属性显示/隐藏它。使用ngAnimate 模块,我为<div> 的显示和隐藏设置了动画。
<div id="square" ng-show="showSquare" class="animate-shiny"></div>
我还想在<div> 上放一门课,为此我使用ngClass。
<div id="square" ng-show="showSquare" class="animate-shiny" ng-class="{ cool: extraCool }"></div>
碰巧的是,有时该类会在显示/隐藏<div> 的同时应用。这会导致显示/隐藏动画不再起作用,显然它发现 ngClass 的动画更有趣,即使我不想为该动画使用 ngAnimate。
Here's a Plnkr that demonstrates the behavior。单击显示/隐藏按钮效果很好,单击制作酷按钮效果很好,但是结合这两者的按钮会导致显示/隐藏动画中断。
我该如何解决这个问题?我可以不手动寻址$animate吗?
提前致谢!
【问题讨论】:
标签: angularjs animation ng-animate