Search code examples
angularangular13ionic6

"TypeError: element['animate'] is not a function" error on ios device, after upgrading to angular v13


We decided to upgrade our ionic app to angular v13.2.3 and to @ionic/angular v6.0.8. After the upgrade, the app was running without any problems in the browser and on android. As we tested it on ios the app was starting, but wasn't showing any content and we got this error:

enter image description here

How can i solve this problem?


Solution

  • We found a solution for this. The error was caused, because my ios version wasn't supported anymore. Angular is only supporting the last 2 major versions of safari meaning the v14 and 15. My device is running on v13.

    The element animate api is only available for versions higher than v13.1.For Versions below you can use this web-animations-js

    Found this issue on github: https://github.com/angular/angular/issues/45016

    What you can do to fix this, is adding or uncommenting this part below in your polifills.ts file:

    enter image description here

    Then you can run npm install --save web-animations-js to install the animation package.

    Now the app should work again.