Last active
June 10, 2021 12:37
-
-
Save muuvmuuv/731a5611bf6ce377fc2b3790e965031e to your computer and use it in GitHub Desktop.
Hide Angular element from dom with Angular animations
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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