Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Importing the BrowserModule into a standalone Angular16 project

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:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

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?

>Solution :

You have provideAnimations() for this !

bootstrapApplication(AppComponent, {
    providers: [
      provideAnimations()
    ]
 })
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading