我的问题是我的代码在 angular 1.1.5 中运行良好,但在较新的版本 (1.4.3) 中却不行。它根本不会将 css 类 xx-leave、xx-enter 放在所需的元素上。
评论中的示例代码(不能放在这里)
它在旧版本中工作得很好,但在新版本中就不行了。
我的问题是,我怎样才能在新版本的 angular js 中完成这项工作?
最佳答案
动画不再是核心的一部分。这意味着您必须下载 ngAnimate
模块并将其包含到您的应用程序中。 (就像您使用 ngResource
一样)。
“ng-animate”指令现已弃用:
Instead, all animations are resolved from the CSS class(es) present on the element when an animation event is triggered and additional CSS classes are applied to the element to specify which animation is occurring. In other words, when a directive such as ngRepeat inserts an element into the DOM, it triggers an animation (the enter animation) and the $animate service appends the ng-enter and ng-enter-active CSS classes to the element.
这些只是 AngularJS 1.2 版中引入的关于动画的几个变化。您可以阅读更多详细信息here .
关于javascript - 新版 Angular 中的 Ng-animate,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31766385/