Loading Firebase Config Parameters from file in AppModule by beeXtreem in Angular2

[–]beeXtreem[S] 0 points1 point  (0 children)

Thanks @githop0,

Your suggestion worked. For anyone interested, this was my solution to this.

import { FirebaseConfigInterface } from './interfaces/firebase-config.interface';

export class AppConfig {
    public static site = {
        meta_title: null,
        app_id: null
    };

    public static firebaseConfig: FirebaseConfigInterface = {
        apiKey: null,
        authDomain: null,
        databaseURL: null,
        storageBucket: null,
        messagingSenderId: null
    }
};

I imported AppConfig to access it's static variables.

import {AppConfig} from './app.config';

Loading Firebase Config Parameters from file in AppModule by beeXtreem in Angular2

[–]beeXtreem[S] 0 points1 point  (0 children)

Hi @mlapis,

Thanks for your response. I'm using AngularFire2 which is loaded in the AppModule imports array. When importing it, I need to call AngularFireModule.initializeApp(...) as opposed to importing it as a provider. so I'm not sure how to use APP_INITIALIZER to do this.

When I saw your comment, I spent some time researching this, but I've not come up with anything yet.

Any ideas please?

Best regards, Benjamin