multiple firebase app for single angular 16 app with AngularFire Module

21 views Asked by At

I am trying to create a app with authorization from one firebase project and application data from different firebase project.

I found few references in the google however nothing works with Angular 16.
Reference on Stack overflow: here

In app.module.ts

AngularFireModule.initializeApp(environment.firebase_app),
AngularFireModule.initializeApp(environment.firebase_auth, "another_app")

In service, I used this

@Inject("another_app") private afs: AngularFirestore,

Getting this following error

main.ts:6 ERROR Error: Uncaught (in promise): NullInjectorError: R3InjectorError(AppModule)[AuthGuard -> AuthService -> another_app -> another_app]: NullInjectorError: No provider for another_app! NullInjectorError: R3InjectorError(AppModule)[AuthGuard -> AuthService -> another_app -> another_app]: NullInjectorError: No provider for another_app

I tried all the possible solutions from the references.

0

There are 0 answers