Skip to main content

Angular Expand-Collapse Animation

This is a very short example to start with Angular animations

  1. Import BrowserAnimationsModule in Module where you need the animation
  2. Create your animation in a separate file, eg: custom-animation.ts
  3. Declare animation inside the @Component decorator of the component using the animation → eg: animations: [customAnimation]
  4. Attach the animation by its declared prefix on desired tag in component's html → eg: <element *ngIf="isExpand" [@customAnimation]='isExpand'>