如何在不创建自定义数据服务的情况下提供 NgRx DefaultDataService?

问题描述

我有一个延迟加载的模块,我不需要任何自定义数据服务。 DefaultDataService 对我来说已经足够了。但我不知道如何提供它。我在文档中只找到了如何提供自定义服务。

我有以下配置,但出现错误 NullInjectorError: No provider for DefaultDataService!

然后我尝试将 DefaultDataService 添加到 App 模块 providers: [DefaultDataService] 中的提供者,但出现错误 Can't resolve all parameters for DefaultDataService: (?,?,?).

app.module.ts

    @NgModule({
      declarations: [AppComponent],imports: [
        BrowserModule,AppRoutingModule,StoreModule.forRoot({
          auth: authReducer,}),EffectsModule.forRoot([AuthEffects]),EntityDataModule.forRoot({}),StoreDevtoolsModule.instrument({
          maxAge: 25,// Retains last 25 states
          logOnly: environment.production,// Restrict extension to log-only mode
        }),HttpClientModule,TranslateModule.forRoot({
          loader: {
            provide: TranslateLoader,useFactory: createTranslateLoader,deps: [HttpClient],},defaultLanguage: 'ru',BrowserAnimationsModule,CoreModule,NgbModule,],providers: [],bootstrap: [AppComponent],})
    export class AppModule {}

teacher.module.ts(延迟加载模块)

    const modules = [
      CommonModule,TeacherRoutingModule
    ];
    
    const components = [
      TeacherComponent,TeacherApplicationComponent
    ];
    
    @NgModule({
      declarations: [...components],imports: [...modules],})
    export class TeacherModule {
    
      constructor(private eds: EntityDefinitionService) {
        this.eds.registerMetadataMap({
          Teacher: {}
        });
      }

所以我不知道如何在不创建自定义服务的情况下提供这个 DefaultDataService。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)