Angular 4 Animations add parameters
Here is the solution I needed
[@leavingTowardsTop]="{value: ':leave', params : {topPixels: '-300px'}}"
You need to parameterize the top
style like so:
export const customAnimation=
trigger('customAnimation', [
transition(':leave', [
animate("500ms ease-in", keyframes([
style({'margin-top': "-{{pixels}}px", 'height': "{{pixels}}px", 'margin-bottom': "0px"}),
]))
], {params : { pixels: "30" }})
]);
Then call it in the view like so:
[@customAnimation]="{value: ':leave', params: { pixels: 100}}"