Hello,
I would like to ask if anyone has an idea on how to achieve the following:
An angular (7.2) UMD NgModule is being loaded from a main angular application.
The code that is loading the UMD module is:
return SystemJS.import(`${url}`).then(
(module) =>
return this.compiler.compileModuleAndAllComponentsAsync(module[${moduleInfo}])
.then(compiled =>
{
console.log(compiled);
return module;
});
);
If I have a static forRoot in the module that I am loading to init it:
export class PlaygroundModule
{
static forRoot
(
config: ModuleConfig = null
): ModuleWithProviders
{
return
{
ngModule: PlaygroundModule,
providers:
[
{ provide: ModuleConfig, useValue: config }
]
};
}
Is there any way to set the values for that forRoot when compiling the code implementing compileModuleAndAllComponentsAsync as I would provide them at design time?
See below..
@NgModule(
{
declarations:
[
AppComponent
]
imports:
[
......
PlaygroundModule.forRoot
({
resourceServer:
{
allowedUrls: ['http://www.codeca.au/api']
setToken: false
}
}),
providers: [],
bootstrap: [AppComponent]
})
export class AppModule
{ }
Thanks
What I have tried:
I haven't found any site that could point me to the right direction yet.