Open bbright-dinesh opened 4 months ago
This issue does not seem to follow the issue template. Make sure you provide all the required information.
Somehow able to solve this by loading the settings from API and setting them in localstorage. For the first time when the app loads it fails but later onwards it will fetch the data from localStorage.
This may be helpful to others.
getConfig().then(async config => { if (config) { setFirebaseConfig(config); platformBrowserDynamic() .bootstrapModule(AppModule) .catch(err => console.error(err)); } });
export async function getConfig() { return fetch('http://localhost:8081/v1/firebase-config').then((response) => { return response.json(); }); }
AngularFireModule.initializeApp({ apiKey: localStorage.getItem('apiKey') ?? '', authDomain: localStorage.getItem('authDomain') ?? '', projectId: localStorage.getItem('projectId') ?? '', storageBucket: localStorage.getItem('storageBucket') ?? '', messagingSenderId: localStorage.getItem('messagingSenderId') ?? '', appId: localStorage.getItem('appId') ?? '', measurementId: localStorage.getItem('measurementId') ?? '', })
Version info
Angular: 14 Firebase: 9.16.0 AngularFire: ^7.4
How to reproduce these conditions
I am using below firebase initialization in app.module.ts, but I would like to load firebaseConfig from a REST api call result. Tried many ways, but failed to achieve this functionality.
Would someone kind enough to help us here please