Angularfire: initializeApp inconsistent API

Created on 23 Sep 2016  路  2Comments  路  Source: angular/angularfire

Firebase initializeApp method accepts two parameters, options and name, see here.

With the current implementation is impossible to pass a name to the initializeApp method, moreover the API is different, because in AngularFire 2 the second parameter is the auth configuration.

Using the library with Angular Universal, you get Error: Firebase App named '[DEFAULT]' already exists. and because its not posible to provide different names is not possible to overcome the error.

To prevent a breaking change in the API, we can allow (firebaseConf, name) and (firbaseConf, authConf, name) as parameters for initializeApp and check type of authConf.

Help Wanted! database chore

Most helpful comment

Hey,
I keep getting the similar errors when setting up AngularFire2 on both modules app.node & app.browser: EXCEPTION: Uncaught (in promise): ReferenceError: window is not defined

And for setting up Angularfire2 only on app.node I get the errors:
1) Error: Firebase App named '[DEFAULT]' already exists.
2) ReferenceError: window is not defined

Any updates on the present API regarding this?

All 2 comments

@leandroz We do need the ability to provide a name, but it is not meant to mirror the Firebase SDK API. We used the name to bring familiarity to the process.

Hey,
I keep getting the similar errors when setting up AngularFire2 on both modules app.node & app.browser: EXCEPTION: Uncaught (in promise): ReferenceError: window is not defined

And for setting up Angularfire2 only on app.node I get the errors:
1) Error: Firebase App named '[DEFAULT]' already exists.
2) ReferenceError: window is not defined

Any updates on the present API regarding this?

Was this page helpful?
0 / 5 - 0 ratings