FirebaseExtended / angularfire

AngularJS bindings for Firebase
MIT License
2.73k stars 632 forks source link

Multiple firebase projects #958

Closed tbone849 closed 4 years ago

tbone849 commented 7 years ago

I would like to be able to configure angularfire to handle multiple firebase projects. Configuring multiple projects is possible via the firebase docs, but from what I can find, angularfire can only handle one project (default) at a time. Below is the code to initialize a second project. However I can't find if angularfire can distinguish between the two.

var secondaryAppConfig = {
    apiKey: "<API_KEY>",
    authDomain: "<PROJECT_ID>.firebaseapp.com",
    databaseURL: "https://<DATABASE_NAME>.firebaseio.com",
    storageBucket: "<BUCKET>.appspot.com",
};

// Initialize another app with a different config
var secondary = firebase.initializeApp(secondaryAppConfig, "secondary");

// Retrieve the database.
var secondaryDatabase = secondary.database();
puf commented 7 years ago

Also posted on: https://stackoverflow.com/q/46821178