ng-repeat animation not working

落爺英雄遲暮 提交于 2019-12-01 08:38:34

1. You have registered two modules:

<html ng-app="plunker">

And:

<body ng-app="testApp">

Remove ng-app from the html tag.

2. You need to load angular-animate.js

3. As you are moving the elements within the array, it's neither enter or leave you should use, but instead move: .ng-move {

4. You are using the ng-animate directive (ng-animate="'animate'") which is deprecated since 1.2. You are also passing it a class that does not exist.

This would work:

.ng-move {
  transition: 1.75s;
  opacity: 0;
}
.ng-move.ng-move-active {
  opacity: 1;
}

But I would recommend giving it a specific class to be able to specify which ng-repeat uses which animation:

.move-animation.ng-move {
  transition: 1.75s;
  opacity: 0;
}
.move-animation.ng-move.ng-move-active {
  opacity: 1;
}

And:

<td class="move-animation" ng-repeat="cust in customers" ng-click="swap(this.$index)">

Demo: http://plnkr.co/edit/fiMORm5ZFLejV1aOUrbR?p=preview

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