Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular animation not working in IE edge

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

like image 612
Haris Avatar asked Jun 18 '17 07:06

Haris


2 Answers

you need to add polyfill in polyfills.ts

remove comments from

import web-animations-js;

then run

npm install --save web-animations-js
like image 134
Dulanga Heshan Avatar answered Sep 27 '22 22:09

Dulanga Heshan


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.

like image 37
Poul Kruijt Avatar answered Sep 28 '22 00:09

Poul Kruijt