我试图将在StateService
类内部生成的数据作为单独的库模块的配置进行传递。
import { ThirdPartyIntegrationsModule } from 'third-party-integrations';
import { StateService} from './services/state.service';
@NgModule({
imports: [
ThirdPartyIntegrationsModule.forRoot({ deviceId: 'I want to use: StateService.deviceId' }),
CommonModule,
],
declarations: [
AppComponent
],
providers: [
StateService
],
bootstrap: [AppComponent]
})
export class AppModule { }
实现此目标的最佳方法是什么?
我尝试创建新的stateservice实例,然后使用该值-但这不起作用:
import { StateService } from './services';
const state = new StateService();
@NgModule({
imports: [
ThirdPartyIntegrationsModule.forRoot({ deviceId: state.trackingId }),