changeDetection: ChangeDetectionStrategy.OnPush,
animations: [
trigger('slide', [
state('1', style({ transform: 'translateX(0)' })),
state('2', style({ transform: 'translateX(-50%)' })),
transition('* => *', animate(300))
])
]
})
export class SlidePanelComponent {
@Input() numberOfStatesToHave
... more code
How can I dynamically set the number of states in angular using the @input decorator?
For example if the @Input numberOfStatesToHave is 3, how can I have three animations states in the animations 'array' in the @Component decorator? And also dynamically pass values to the transform css property?