Perform below steps to make it work:
-
npm install @angular/animations@latest –save
-
import “BrowserAnimationsModule” from “@angular/platform-browser/animations” in your root NgModule (Without this, your code will compile and run, but animations will trigger an error)
-
In your component use imports from the new package like this – ” import { trigger, state, style, transition, animate } from ‘@angular/animations’; “
This worked for me.