NullInjectorError is thrown upon adding the AngularFireAnalyticsModule in Angular 13 #3248
-
I am trying to add firebase analytics using @angular/fire with my Angular 13 project. When adding AngularFireAnalyticsModule to my app.module.ts file, I get the NullInjectorError in my browser console shown below. This results in the website not loading.
With the following setup, I am able to emulate/deploy my Angular 13 project with no trouble. app.module.ts settings:
firebase variable data found in environment.ts:
my package.json
If I was to uncomment AngularFireAnalyticsModule in the app.module.ts file, the website will brake, and the NullInjectorError will be shown. I have not added any other analytics code to other components in the project. This is the only change. I am following the setup documentation given below and my understanding is the only required code for setting up analytics is to add this module so I do not know what I could be doing to cause this error. Would anyone know what could be causing this error and how to fix it? https://github.com/angular/angularfire/blob/HEAD/docs/install-and-setup.md https://github.com/angular/angularfire/blob/master/docs/analytics/getting-started.md Thank you ahead of time for your help. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I found my solution. I did not catch that I need to add the code below to the app.module.ts file. I did not get this step while following the https://github.com/angular/angularfire/blob/master/docs/analytics/getting-started.md documentation.
|
Beta Was this translation helpful? Give feedback.
I found my solution. I did not catch that I need to add the code below to the app.module.ts file. I did not get this step while following the https://github.com/angular/angularfire/blob/master/docs/analytics/getting-started.md documentation.
AngularFireModule.initializeApp(environment.firebase),