How to use the animation trigger from separate .ts file in Angular?

Published

There is an example of exporting an animation trigger in Angular:

import { animation, style, animate, trigger, transition, useAnimation } from '@angular/animations';
export const triggerAnimation = trigger('openClose', [
  transition('open => closed', [
    useAnimation(transitionAnimation, {
      params: {
        height: 0,
        opacity: 1,
        backgroundColor: 'red',
        time: '1s'
      }
    })
  ])
]);

But I can’t figure out how do I use it in my component. There is the useAnimation() method bun no methods like useTrigger() or something like it.

How to use the animation trigger from separate .ts file in Angular?

Source: Angular Questions

Published
Categorized as angular, animation, css, html, javascript Tagged , , , ,

Answers

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Still Have Questions?


Our dedicated development team is here for you!

We can help you find answers to your question for as low as 5$.

Contact Us
faq