gpt4 book ai didi

javascript - 只有 ngRepeat 中的第一个元素是动画的

转载 作者:行者123 更新时间:2023-11-29 14:52:33 25 4
gpt4 key购买 nike

如果我在我的应用中加载异步数据。 NgRepeat 仅对数组中的第一个元素进行动画处理。

jsFiddle

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 来模拟异步数据源。

这是为什么。

谢谢!

最佳答案

我猜这是一个错误,此后已修复。自 1.2.* 版本以来,animate 模块发生了大量变化。

Here is a JsFiddle它具有来自 git 的最新源代码,用于嵌入动画模块,问题已经消失。如果您需要此功能,那么您最好使用最新的源代码加载您自己的动画模块版本。

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.

关于javascript - 只有 ngRepeat 中的第一个元素是动画的,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23144032/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com