I am trying to create a component that can (potentially) have as many children as needed. So I created a stepper component which consists of two components, the parent (Stepper) and child (Step). They are pretty simple in design, the stepper html looks like this:
<div class="panes">
<ng-content></ng-content>
</div>
And the step html looks like this:
<div [ngClass]="{'expanded': expanded}"><ng-content></ng-content></div>
In my application it is a little more advanced, but you will get the idea if I keep it simple :) I have created a stackblitz here:
https://stackblitz.com/edit/angular-jsj2na
Now I have the stepper, I would like to create some animations. There are a couple of ways I could do this, but I started with this idea:
https://stackblitz.com/edit/angular-pkgh4v
This works in a crude way, but it doesn't take into consideration n+ steps. I would love to use Angular Animations, but I have no idea how to pass variables to it (or even if you can!) I had this animation declared:
trigger('slide', [
state('left', style({ transform: 'translateX(0)' })),
state('right', style({ transform: 'translateX(-50%)' })),
transition('* => *', animate(300)),
]),
But as you can see, this only works with 2 steps.... Can anyone help?