Looking to dynamically insert a value into the ngModule of the app module, retrieved from an api call (which fetches configuration details).
In the module below, I am trying to update the rootUrl based on the fetched configuration. I have attempted various methods without success. Is there a solution to this problem?
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
BrowserAnimationsModule,
HttpClientModule,
AppRoutingModule,
ApiModule.forRoot({rootUrl: config.url}) <-- Need help here
],
providers: [
AppConfig,
{
provide: APP_INITIALIZER,
useFactory: (config: AppConfig) => () => config.load(),
deps: [AppConfig],
multi: true
},
],
bootstrap: [AppComponent]
})
export class AppModule {
}