title: angularfire2 firebase config switch dynamically in the ionic app
body: <p>I am using angularfire2 in my ionic app following <a href="https://github.com/angular/angularfire2/blob/master/docs/ionic/cli.md" rel="nofollow noreferrer">https://github.com/angular/angularfire2/blob/master/docs/ionic/cli.md</a> </p>
  
  <p>The step 4 and 5 looks like below in my app</p>
  
  <pre><code>export const firebaseConfig = {
    apiKey: "XXXXXX",
    authDomain: "XXX.firebaseapp.com",
    databaseURL: "https://XXX.firebaseio.com",
    storageBucket: "XXXX.appspot.com",
    messagingSenderId: '542659015683'
  };
  
  @NgModule({
    declarations: [
      MyApp,
      HomePage,
      TabsPage,
      LoginPage
    ],
    imports: [
      BrowserModule,
      ComponentsModule,
      IonicModule.forRoot(MyApp),
      AngularFireModule.initializeApp(firebaseConfig),
      AngularFireDatabaseModule,
      AngularFireAuthModule,
      HttpClientModule
    ],
    bootstrap: [IonicApp],
    entryComponents: [
  ...
  </code></pre>
  
  <p>The above works just fine. However, we want to run the same app in dev or production mode. The difference will be the firebase side configuration. </p>
  
  <p>So, the way to do this is planned using a switch in the app to toggle as dev or production. And on toggling the switch we should be able to re-initialize the firebase config. Which would be basically re-executing below having a different firebaseConfig payload.</p>
  
  <pre><code>AngularFireModule.initializeApp(firebaseConfig),
  </code></pre>
  
  <p>Please advise how to achieve this.</p>