how can I have multiple apps in Angular 4 with angularfire2

0

The documentation says this:

@NgModule({
  imports: [
    BrowserModule,
    AngularFireModule.initializeApp(environment.firebase, '**my-app-name'**)
  ],
  declarations: [ AppComponent ],
  bootstrap: [ AppComponent ]
})
export class AppModule {}

How do I access my-app-name in java classic script I access via:

var otherAPP =firebase.initializeApp(environment.firebase, '**my-app-name'**)

but as in angular 4 ?

    
asked by saul romero 27.06.2017 в 01:28
source

1 answer

0

First you have to import firebase at the beginning of the file where you need to use it:

import * as firebase from 'firebase/app';

Then you can use your code:

const otherAPP = firebase.initializeApp(environment.firebase2,'**my-app-name'**);

If you want to use it with an angularfire2 component (eg AngularFireAuth):

const auth = new  AngularFireAuth(otherAPP);
    
answered by 05.10.2017 / 03:13
source