For anyone interested, this was my solution.

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';



Best regards,

Benjamin

On Saturday, 29 April 2017 09:03:43 UTC+1, Benjamin Ugbene wrote:
>
> Hello again, I'm building an Angular 4 app with Firebase, and I do not 
> want to save my Firebase configuration/initialization parameters in my 
> app.modules.ts file - as this file is to be committed to my repo.
>
> In dev mode, I was able to save the parameters using `export default 
> {firebase {...}}` in a file called `app.config.ts, and load the params from 
> there. However, when I build using Angular CLI, these parameters are not 
> loaded. I get the following error `Cannot read property 'databaseURL' of 
> null`
>
> The solutions I've found online so far, all work as services, but I need 
> to be able to load these parameters when importing modules in my AppModules 
> class.
>
> Any ideas please?
>
> Best regards,
>
> Benjamin
>

-- 
You received this message because you are subscribed to the Google Groups 
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.
  • [AngularJS] Loading... 'Benjamin Ugbene' via Angular and AngularJS discussion
    • [AngularJS] Re... 'Benjamin Ugbene' via Angular and AngularJS discussion

Reply via email to