As of right now, the code is working as it should (but now how I want haha). The animation works and fades in when the page initially loads & is first initialized but the animations do not occur when I am accessing routes within the after the initial page fade in. Just wondering how I could implement my animation to each sibling route.
Any help is appreciated, thank you!
Below are my app component files where I wrote the animation. I then put the trigger into the HTML.
app.component.ts
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css'],
animations:[
trigger('main-router', [
state('in', style({
opacity: 1
})),
transition('void => *', [
style({opacity: 0}),
animate(2000)
]),
transition('* => void', [
style({opacity: 0}),
animate(2000)
])
])
]
})
app.component.html
<div class="router-outlet-outer" [@main-router] >
<router-outlet>
</router-outlet>
</div>