javascript - Angular animate 的 classNameFilter 与 Angular-bootstrap

标签 javascript angularjs twitter-bootstrap ng-animate angular-bootstrap

我首先必须在应用程序中使用 $animateProvider.classNameFilter() 。它加快了一切。

在 0.12.* 中,Angular-Bootstrap 没有使用 ngAnimate。因此,我能够使用 $animateProvider.classNameFilter(/animate/) 以及 Angular-bootstrap 中的所有内容正确进行动画处理。

现在我正在迁移到更新的 Angular 和 Bootstrap 版本。更改库文件后, Accordion 和折叠停止工作。我发现上述函数导致了我的问题:http://plnkr.co/edit/uGjQzKCy6hrj0V8MVBxD?p=preview (注释/取消注释 example.js 中的第 4 行)。

如何才能正确使用此功能?正则表达式应该如何覆盖 ngAnimate 和 angular-bootstrap 的所有动画?

最佳答案

选项 1 - 添加 animate类到您想要使用 Angular-Bootstrap 制作动画的每个元素。使用轮播的示例

<div uib-carousel active="active" interval="-1" no-wrap="true">
  <div uib-slide class="animate" index="0">
    <img src="http://nick.mtvnimages.com/nick/video/images/nick/spongebob-050-full-episode-16x9.jpg" style="width:100%">
    <div class="carousel-caption">
      <h4>Custom slide 1!!</h4>
    </div>
  </div>
  <div uib-slide class="animate" index="1">
    <img src="http://nick.mtvnimages.com/nick/video/images/nick/spongebob-050-full-episode-16x9.jpg" style="width:100%">
    <div class="carousel-caption">
      <h4>Custom slide 2!!</h4>
    </div>
  </div>
  <div uib-slide class="animate" index="2">
    <img src="http://nick.mtvnimages.com/nick/video/images/nick/spongebob-050-full-episode-16x9.jpg" style="width:100%">
    <div class="carousel-caption">
      <h4>Custom slide 3!!</h4>
    </div>
  </div>
</div>

选项 2 - 请勿调用 classNameFilter 。缺点:保持 HTML 浅薄,也就是确保过去携带 animate 的元素类不会嵌套在其类/可见性会更改的父 div 中,因为 data-ng-animate应用于最顶层元素和内部函数 areAnimationsAllowed (angular-animate.js) 将阻止任何子项的动画。

PS。我希望 Angular-Bootstrap 提供某种配置以更好地与 classNameFilter 配合使用.

关于javascript - Angular animate 的 classNameFilter 与 Angular-bootstrap,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32560062/

相关文章:

javascript - 子类化错误: adding prototype methods does not take effect

javascript - 正则表达式意外字符

html - Bootstrap 模态不工作

javascript - 使用复选框实时更新 UI

javascript - 将鼠标悬停在非链接元素上时使链接可见

javascript - 指令属性中的花括号,angularJS

javascript - 带有图标的 Angular 指令和 dhtmlxcalendar

css - 框中的图像没有做出正确的响应

css - Bootstrap Button Dropdown 隐藏在 div 后面

javascript - 如何知道 iframe 何时已完成加载 DOM,但尚未加载所有图像?