我几乎找不到这个.谷歌上出现的几乎所有东西都是关于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; }
我希望这有帮助!