我想在SVG元素上使用Angular 1.2.0rc3动画ngRepeat
,但是我找不到我的代码无法工作的原因。在SVG元素上的角度动画
其实,下面的代码工作完美:
<svg xmlns="http://www.w3.org/2000/svg" width="200" height="100">
<rect ng-repeat="item in itemsList" width="10" height="50" fill="gold" data-ng-attr-x="{{$index*15}}" class="animation" />
</svg>
<div>
<div ng-repeat="item in itemsList" class="animation">[{{$index}}] {{item}}</div>
</div>
.animation.ng-enter,
.animation.ng-leave
{
transition-property: opacity;
transition-duration: 2000ms;
}
.animation.ng-enter.ng-enter-active,
.animation.ng-leave
{
opacity: 1;
}
.animation.ng-enter,
.animation.ng-leave.ng-leave-active
{
opacity: 0;
}
但对于某些神秘的原因,当我把这些线在我真正的项目,则<rect>
元素不再生气了。然而,<div>
元素仍然是动画。最后,当我手动添加现有元素上的.ng-leave
和.ng-leave-active
类(例如使用Firebug)时,我可以看到<rect>
逐渐消失,如预期的那样。一个相当不错的Heisenbug,对吧?
请注意,我也在我的项目中使用jQuery。
有人已经遇到过类似的问题,或者只是对发生了什么有所了解?
很好调查!希望你能在未来用别的方式挽救别人的头痛。 –