我正在这样platformBrowserDynamic
中加载配置数据:
platformBrowserDynamic([{ provide: MyConfig, useValue: new MyConfig(data.config) }])
MyConfig
是一门课程:
export class MyConfig {
setting1: string;
setting2: string;
other: {}
constructor(data: any) {
this.setting1 = data.setting1;
this.setting2 = data.setting2;
this.other = data.other;
}
}
我的MyCustomModule
export function someFactoryTest() {
debugger; //<--got debugger steps here
return 'something';
}
export function initializeConfig(config: MyConfig) {
debugger; //<--debugger does not steps here and no errors in console.
return config.other;
}
@NgModule({
imports: [
MyOtherModule.forRoot(initializeConfig, someFactoryTest) //<-- I want to be able to pass my params here
],
})
export class MyCustomModule {}
我无法从MyConfig
获取值,试图进行调试,但有趣的是,调试器根本不介入initializeConfig
您是否有办法解决这个问题?