如何禁用角度2动画进行量角器测试?

前端之家收集整理的这篇文章主要介绍了如何禁用角度2动画进行量角器测试?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我几乎找不到这个.谷歌上出现的几乎所有东西都是关于Angular 1的,而我发现的Angular 2并没有起作用( http://www.talkinghightech.com/en/angular-2-end-2-end-testing/).

我正在寻找一种方法来禁用CSS动画和我的角度2组件上的动画.

解决方法

现在 this bug关闭,您可以使用名为@ .disabled的特殊绑定禁用子动画.它既可以应用于本地组件,也可以应用于应用程序.

这是他们的代码文档的引用:

@Component({
  selector: 'my-component',template: 
    <div [@.disabled]="isDisabled">
      <div [@childAnimation]="exp"></div>
    </div>
  animations: [
    trigger("childAnimation",[
      //...
    ])
  ]
})

class MyComponent {
  isDisabled = true;
  exp = '...';
}

或者应用范围:

import {Component,HostBinding} from '@angular/core';

@Component({
  selector: 'app-component',templateUrl: 'app.component.html',})
class AppComponent {
  @HostBinding('@.disabled')
  public animationsDisabled = true;
}

我希望这有帮助!

猜你在找的Angularjs相关文章