I have a project which is a social app made with ionic angular and I want to include the firebase imports in it
provideFirebaseApp(() => initializeApp(environment.firebase)),
provideFirestore(() => getFirestore())
The issue is that those imports should be in the app.module.ts file while the current component is a standalone component. I don’t know where to put the imports as I should import:
import { provideFirebaseApp, getApp, initializeApp } from '@angular/fire/app';
import { getFirestore, provideFirestore } from '@angular/fire/firestore';
2
Answers
Maybe you need to provide your firebase app on application bootstrapping like this:
I need to clean it up but I’m using:
And then including the following like a provideFirebase() in the providers of
bootstrapApplication
:Note you can also add providers to the router so not everything has to go onto the root provider but in this case it makes sense.
—-
In the new standalone world, instead of bootstrapping based off a module the application bootstraps based off a component in
main.ts
:With
appConfig
collocated with the app component in source:src/app/app.config.ts
example from RealWorld Example App: