javascript - 新版 Angular 中的 Ng-animate

标签 javascript css angularjs

我的问题是我的代码在 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/

相关文章:

javascript - AngularJS指令如何在条件下显示/隐藏自定义(附加)元素

javascript - 从 AngularJs 中的 Controller 绑定(bind) ngModel 或从 ngModel 调用函数

javascript - 如何让 jquery 在循环中的每个 ajax 调用后立即追加输出

CSS 少了背景图片和渐变?

html - 图像不会在 html 页面中溢出

css - iOS 15 Safari float 地址栏

php - 删除两个单词之间的空格

javascript - 渲染到 ember View 的导出

javascript - $watch 检查 AngularJS 范围内定义的变量

javascript - 将表情符号作为短信中的文本发送