Closed danielfliegauf closed 7 years ago
@danielfliegauf Not sure if I got your question, but are you asking how to connect to firebase from your angular2 App. Also, you're not following the issue template.
Hi Mukesh, thanks for the quick reply. I am using angularFire2 version beta0.7.
My Question is: "How can I connect in an Angualar2 app to two different Firebase Apps/RealTimeDatabases using angularFire2?"
¯_(ツ)_/¯---------------------------------------------------------
This is probably not right, is it?
@NgModule({ imports: [ BrowserModule, AngularFireModule.initializeApp(firebaseConfig, authConfig, 'my-app-name'), AngularFireModule.initializeApp(firebaseConfig2, authConfig2, 'my-app-name2') ], declarations: [ AppComponent ], bootstrap: [ AppComponent ] }) export class AppModule {}
¯_(ツ)_/¯----------------------------------------------------------
It would be great if you could update your docs and show how to do it the right way. Thank you! :)
up, plase help us
appears to be a duplicate of #761
can be closed
@danielfliegauf . How did you solve the issue? While there have been many answers given, somehow I am not getting it. I was also wondering if we have to add the initialize method twice. How did you go about solving the issue? Thanks.
The Firebase Docs describe quite nicely how to connect to two different apps.
// Initialize the default app firebase.initializeApp(defaultAppConfig);
// Initialize another app with a different config var otherApp = firebase.initializeApp(otherAppConfig, "other");
console.log(firebase.app().name); // "[DEFAULT]" console.log(otherApp.name); // "other"
// Use the shorthand notation to retrieve the default app's services var defaultStorage = firebase.storage(); var defaultDatabase = firebase.database();
// Use the otherApp variable to retrieve the other app's services var otherStorage = otherApp.storage(); var otherDatabase = otherApp.database();
I found on your GithubPages the following: https://github.com/angular/angularfire2/blob/master/docs/1-install-and-setup.md#custom-firebaseapp-names
But how do i get a reference within ng2 to this two firebase-apps? Could you maybe update your documentation?
Thank you a lot and 👍 for all this awesome work!! Daniel