Angular 2 animations/transitions 只在 chrome 上工作?

Angular 2 animations/transitions only working on chrome?

正如标题所说,我一直在使用 Angular2 构建一个网络应用程序并决定测试 cross-browser,结果发现漂亮的动画只能在 Chrome 中运行。这是我的一个组件的样子,如果这可能有什么不同的话:

@Component({
  selector: 'contact',
  templateUrl: 'app/about.component.html',
  styleUrls: ['app/about.component.css'],
  
  host: {
     '[@routeAnimation]': 'true',
     '[style.position]': "'absolute'",
     '[style.margin]':"'auto'",
     '[style.text-align]':"'center'",
     '[style.width]':"'100%'",
     '[style.display]':"'block'"

     
    
   },
  animations: [
    trigger('routeAnimation', [
      state('*', style({transform:            'translateX(0)', opacity: 1})),
      transition('void => *', [
        style({transform: 'translateX(100%)',   opacity: 0}),
        animate(500)
      ]),
      transition('* => void', animate(500, style({transform: 'translateX(100%)', opacity: 0})))
    ])
  ],
   
})

我可能是什么missing/What 我可以尝试实现以具有 cross-browser 功能吗?

谢谢

来自“https://angular.io/docs/ts/latest/guide/animations.html”:

Angular animations are built on top of the standard Web Animations API and they run natively on browsers that support it.

Web 动画 API 目前没有得到很好的支持。请检查:http://caniuse.com/#feat=web-animation

您需要使用 polyfill 才能使动画正常工作。这个https://github.com/web-animations/web-animations-js可以用

您需要导入 polyfill 以支持这些浏览器的 Web 动画。

将这些行添加到您的 src/polyfills.ts:

/**
 * Required to support Web Animations `@angular/animation`.
 * Needed for: All but Chrome, Firefox and Opera. 
   http://caniuse.com/#feat=web-animation
**/
import 'web-animations-js';  // Run `npm install --save web-animations-js`.

但是,网络动画应该可以与 Chrome、Firefox 和 Opera 一起使用,而无需导入此 polyfill。