最佳答案
1.您已经注册了两个模块:
<html ng-app="plunker">
还有:
<body ng-app="testApp">
从 html 标签中移除 ng-app
。
2.你需要加载angular-animate.js
3. 当您在数组中移动元素时,您应该使用的不是 enter
或 leave
,而是 移动
:.ng-move {
4. 您正在使用自 1.2 起已弃用的 ng-animate
指令 (ng-animate="'animate'"
) .您还向它传递了一个不存在的类。
这可行:
.ng-move {
transition: 1.75s;
opacity: 0;
}
.ng-move.ng-move-active {
opacity: 1;
}
但我建议给它一个特定的类,以便能够指定哪个 ng-repeat 使用哪个动画:
.move-animation.ng-move {
transition: 1.75s;
opacity: 0;
}
.move-animation.ng-move.ng-move-active {
opacity: 1;
}
还有:
<td class="move-animation" ng-repeat="cust in customers" ng-click="swap(this.$index)">
关于angularjs - ng-repeat 动画不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23465253/