如果我在我的应用中加载异步数据。 NgRepeat仅动画数组中的第一个元素。
HTML:
<div ng-repeat="x in data"></div>
的CSS:
.box.ng-enter {
-webkit-transition: all 2s ease;
transition: all 2s ease;
opacity: 0;
top: 20px;
}
.box.ng-enter-stagger {
-webkit-transition-delay: 0.2s;
transition-delay: 0.2s;
}
.box.ng-enter.ng-enter-active {
opacity: 1;
top: 0;
}
在这个例子中,我使用$ timeout来模拟异步数据源。
为什么会这样。
谢谢!
答案 0 :(得分:2)
我的猜测是这是一个已被修复的错误。自1.2。*发布以来,动画模块发生了大量更改。
Here is a JsFiddle具有来自git的最新源代码,用于嵌入动画模块,问题已经消失。如果您需要此功能,那么最好使用最新的源加载您自己版本的animate模块。
Here you can compare the 1.2.* branch to the master branch查找“src / ngAnimate / animate.js”以查看模块的所有更改。
Ignore - needed to get the fiddle link to work i get the motivation
behind requiring code along with a fiddle but in this case it actually makes
little sense the only modification made to the original was the addition of
1600 lines of code taken from the latest version of the module. I'm not
putting that in here.