Skip to content

Connecting to two Firebase Apps #846

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

Closed
danielfliegauf opened this issue Feb 28, 2017 · 6 comments
Closed

Connecting to two Firebase Apps #846

danielfliegauf opened this issue Feb 28, 2017 · 6 comments

Comments

@danielfliegauf
Copy link

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

@mukesh51
Copy link
Contributor

@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.

@danielfliegauf
Copy link
Author

danielfliegauf commented Mar 2, 2017

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! :)

@ghost
Copy link

ghost commented Apr 24, 2017

up,
plase help us

@jaimealsilva
Copy link

Checkout #761

@Toxicable
Copy link

appears to be a duplicate of #761

can be closed

@biowheel
Copy link

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants