Angular 2 animations/transitions only working on chrome?

耗尽温柔 提交于 2019-12-05 09:22:10

From '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.

The Web Animation API is not well supported right now. Please check: http://caniuse.com/#feat=web-animation

You need to use a polyfill to get the animations working. This one https://github.com/web-animations/web-animations-js can be used.

You need to import polyfills to support Web Animations for these brwosers.

Add these lines in your 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`.

However, web animations are supposed to work with Chrome, Firefox and Opera without importing this polyfill.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!