DEV Community

Discussion on: Using Lottie Animations inside Angular or Ionic 4

Collapse
 
chilupa profile image
Pavan Chilukuri • Edited

Appreciate your write up. How do I make it work in my scenario below.
I already have import { defineCustomElements } from '@ionic/pwa-elements/loader'; statement in main.ts file.
How do i add import { defineCustomElements } from '@teamhive/lottie-player/loader'; in this case?
Could you please help? I'm using Ionic 5

Collapse
 
seanperkins profile image
Sean Perkins

With TypeScript, you can import a class/const/etc. with an alias, to avoid name collision.

For example, you could do this:

import { defineCustomElements as defineLottieCustomElements } from '@teamhive/lottie-player/loader';

defineLottieCustomElements(window);

You can name the variable whatever you'd like, with the as syntax.