0

Angular 16 is recently released and I have created a new standalone project without any module. then in a standalone component I need to import BrowserAnimationsModule from angular/platform-browser/animations. but when I import it, this error occures:

Poviders from the BrowserModule have already been loaded. If you need access to common directives such as NgIf and NgFor, import the CommonModule instead.

and when I remove it this one:

Unexpected synthetic listener @animation.start found. Please make sure that: Either BrowserAnimationsModule or NoopAnimationsModule are imported in your application.

so why first error occures? where is BrowserModule already loaded? and if it has already been imported how do I use it?

Zahra Rabbani
  • 83
  • 1
  • 6

1 Answers1

2

You have provideAnimations() for this !

bootstrapApplication(AppComponent, {
    providers: [
      provideAnimations()
    ]
 })
Matthieu Riegler
  • 31,918
  • 20
  • 95
  • 134