animation - Angular2 教程动画不适用于 IE11

标签 animation angular internet-explorer-11

我按照 Angular2 教程使用快速启动种子 [1] 设置了本地开发环境,效果很好。然后我决定使用 [2] 中第一个示例的缩短版本来测试动画。 app.component.ts 看起来像这样,它通过单击切换背景颜色:

import {
  Component, trigger, state, style, transition, animate
} from '@angular/core';

@Component({
  selector: 'my-app',
  template: `<div [@heroState]="state" (click)="toggleState()">
                <h1>TourOfHeroes</h1>
            </div>
  `,
  animations: [
    trigger('heroState', [
      state('inactive', style({
        backgroundColor: '#eee'
      })),
      state('active',   style({
        backgroundColor: '#cfd8dc'
      })),
      transition('inactive => active', animate('1000ms ease-in')),
      transition('active => inactive', animate('1000ms ease-out'))
    ])
  ]
})

export class AppComponent {

  state = 'active';

  toggleState(){
    this.state = (this.state === 'active' ? 'inactive' : 'active');
  }
}

这在 Chrome 和 Firefox 中运行良好,但在 IE11 中不起作用。没有过渡的是IE11,背景瞬间变化(见[3])

我没有自己做项目设置,除了插入的动画代码之外几乎没有编码。有什么办法可以说明为什么这不起作用吗?

谢谢!

[1]:github.com/angular/quickstart/archive/master.zip

[2]: Angular .io/docs/ts/latest/guide/animations.html

[3]:i.imgur.com/WU3rvEW.gif

PS:Stackoverflow 不允许我发布两个以上的链接,你必须自己复制它们......

最佳答案

关于animation - Angular2 教程动画不适用于 IE11,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40862365/

相关文章:

java - 绘制到 java.awt.graphics 对象中的有效方法

javascript - 在 Angular 5 *nfFor 中为循环的每次迭代设置 bool 值

javascript - Windows 8 中的站点损坏的 IE11 - 进入企业模式

javascript - html2canvas导致IE11挂起进入 "Not responding"状态

css - 如何在多个字符串上使用 CSS 应用类型编写器动画

c# - 使用 MVVM 的动态 View 动画

javascript - 在测试自定义指令时无法读取未定义的属性 'value',该指令使用 jasmine 在 Angular 中获取注入(inject)的表单控件

html - IE 11 剪切文本

css - 在动画部分之间切换

javascript - 如何设计一个全局类来存储 Angular 中的设置?