I have the same animation triggers in most of my components.
Is there a way to import a set of triggers only once for the entire app globally or for specific feature-modules?
export const FADE_ANIMATION = [
trigger('fade', [
transition(':enter', [style({ opacity: 0 }), animate(200)]),
transition(':leave', animate(200, style({ opacity: 0 }))),
]),
trigger('fadeIn', [transition(':enter', [style({ opacity: 0 }), animate(200)])]),
trigger('fadeInListItem', [transition(':enter', [style({ opacity: 0 }), animate(100)])]),
trigger('fadeInList', [transition(':enter', [query('@fadeInListItem', stagger(50, animateChild()), { optional: true })])]),
];
@Component({
selector: 'some-app-cmp',
templateUrl: './some-app-cmp.component.html',
styleUrls: ['./some-app-cmp.component.css'],
animations: [...FADE_ANIMATION],
})
The official docs only tell that you can import predefined animations like i'm already doing.