【发布时间】:2014-12-14 08:36:09
【问题描述】:
我正在制作一个简单的动画,它会在数组更改时使背景颜色产生脉冲。
Plunker:http://plnkr.co/edit/27K6B6vHa4ayuPbgRSP3?p=preview
我的指令:
app.directive('animateOnChange', ['$animate', function($animate) {
return function(scope, elem, attr) {
scope.$watchCollection(attr.animateOnChange, function() {
$animate.addClass(elem, 'on').then(function() {
$animate.removeClass(elem, 'on');
});
});
};
}]);
似乎addClass 和removeClass 同时运行,而on 类从未被移除。它淡入淡出,但不会淡出。
【问题讨论】:
标签: angularjs ng-animate