Angular animation not working in IE edge

我怕爱的太早我们不能终老 提交于 2019-12-23 07:07:47

问题


I added an animation to my component in Angular. However the animation WORKS FINE in Chrome and Firefox, but in IE Edge the animation is NOT triggerd although the styles are applied correctly on state change, but just without specified animation.

Does anyone have the same issue?

Here is my code:

animations: [
    trigger('rowState', [
        state('collapsed', style({
            'height': 0,
            'overflow-y': 'hidden'
        })),
        state('expanded', style({
            'height': '*',
            'overflow-y': 'hidden'
        })),
        transition('collapsed <=> expanded', [animate('1000ms ease-out')])
    ])
]

Thanks in advance


回答1:


Web animation is not supported in edge, you should add the polyfill

Angular animations are built on top of the standard Web Animations API and run natively on browsers that support it. For other browsers, a polyfill is required. Grab web-animations.min.js from GitHub and add it to your page.




回答2:


you need to add polyfill in polyfills.ts

remove comments from

import web-animations-js;

then run

npm install --save web-animations-js


来源:https://stackoverflow.com/questions/44612735/angular-animation-not-working-in-ie-edge

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