-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Document properly how to use multiple Firebase projects in one app #1305
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
merci :) |
@swftvsn My solution is implemented in an Ionic application that I am working on.. This is tested and working (so far :) ) Below is my configuration: Say the 2 Firebase application configuration variables are firebaseConfigA & firebaseConfigB with their names 'appA' & 'appB ' stored in firebaseAppNameA & firebaseAppNameB. Note: It is recommended that all such configuration variables are stored in a separate configuration file / custom webpack environment files. The variables will be imported wherever required from here. In my case, I have custom webpack environment setup. Initializing the Firebase applications in your application's ngModule is not required as this will now be done through a service as shown below. To the code... All my Firebase related function are handled in a separate service:
Import the above service in your application's ngModule. Now, using the service in a component where I connect to both applications:
Hope this helps. |
hi, thanks you |
i try to use multiple config : @component({ constructor(private afs: AngularFirestore, public app: FirebaseApp) { } source : https://stackblitz.com/edit/angular-aw3pyc "angularfire2": "^5.0.0-rc.6", thanks you |
Also you may look into this stalkblitz, |
@fbayanati this works well, I implemented it in my project and it goes well, but how do I integrate the session start of the second database? |
Hi @james11a Could you give me an example project of this that you put here, the truth is that I have 4 days and still can not find how to place it correctly, I would like to find the solution since I have an app that needs the integration of three firestore projects and I do not own the complete experience to understand how you have solved it, I would really appreciate it if you could provide me with something more detailed. |
There's a lenghty discussion about this in #1240, and one stackblitz example how to do it, thanks for that!
The comments keep piling, so it seems this is still a source of frustration to people.
The documentation should include examples how to...
@Injectable()
)@Injectable()
)So, essentially how to inject like this:
I don't think Angular supports injection scheme like that, but a blueprint how to achieve the same would be nice. (If I can choose which one to inject, then I can make two wrapper services, that I can inject..)
It would be nice though to be just able to say:
which would return the angularfireified firestore etc. services.
The text was updated successfully, but these errors were encountered: