I have the following animation code attached to my component
animations:[
trigger('slide', [
state('show', style({
height: '*'
})),
state('hide', style({
position: 'relative',
height: 0,
overflow: 'hidden'
})),
transition('show <=> hide',animate('130ms ease-out'))
])
]
This is quite hard to explain, (and I can't seem to get animations to work on plunker) but here goes.
The current functionality is as follows:
- User clicks a button to display table.
- Table smoothly slides into view from below a div.
- User click button again.
- Table smoothly slides out of the view up into the div.
The desired functionality is as follows:
- User clicks a button to display table.
- Table smoothly slides into view from below a div.
- More rows are added to table (could be a large number of rows)
- Animation handles the new table height and instead of just instantly being displayed there is a smoothing animation to gradually move to the new height.
- User Clicks button.
Table slides back up under div again.
Edit: here is a plunker demo. You can see when you add/remove rows from the table the animation does not smoothly move to the new height.
The problem is caused because if you are in true state and rows are added.
The animation will not transition to true again, because it is already in true state.
So how will I trigger a transition to the "newHeight" state when items are added?