Skip to content

Instantly share code, notes, and snippets.

@muuvmuuv
Last active June 10, 2021 12:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save muuvmuuv/731a5611bf6ce377fc2b3790e965031e to your computer and use it in GitHub Desktop.
Save muuvmuuv/731a5611bf6ce377fc2b3790e965031e to your computer and use it in GitHub Desktop.
Hide Angular element from dom with Angular animations
@Component({
animations: [
trigger('visible', [
state(
'false',
style({
height: '0',
display: 'none',
})
),
transition('* => false', [
animate(
'100ms',
keyframes([
style({ height: '*', offset: 0 }),
style({ height: '0', 'padding-block': '0', offset: 1 }),
])
),
]),
]),
],
})
export class Component {
@HostBinding('@visible')
visible = true
close(): void {
this.visible = false
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment