Use case, I have two animations: fader and slideLeft.
I would like to be able to switch them out. I was trying to set the animationTrigger dynamically? but can't quite figure it out?
component.ts
import { Component, OnInit } from '@angular/core';
import { RouterOutlet } from '@angular/router';
import { fader, slideLeft } from '../route-animations';
import { AnimationTriggerMetadata } from '@angular/animations';
@Component({
selector: 'secure',
templateUrl: './secure.component.html',
animations: [
fader,
slideLeft
]
})
export class SecureComponent implements OnInit {
// nav bar open or small
isOpen = true;
animationTrigger: AnimationTriggerMetadata ;
constructor(
) {
}
prepareRoute(outlet: RouterOutlet) {
console.log("route animation - secure", outlet);
return outlet.isActivated ? outlet.activatedRoute : '';
}
}
component.html
<div [@animationTrigger]="prepareRoute(outlet)">
<router-outlet #outlet="outlet"></router-outlet>
</div>