Weissvonnix
Weissvonnix

Reputation: 763

Injection Token Provider definition for Lazy Loaded Module not working

I have defined a module for data access in my angular application and I am using NgRx/Data.

The Module hierarchy looks like this:

AppModule

Within my Customer-Data-Module I have set the providers array for the pluralName configuration like this:

@NgModule({
  declarations: [

  ],
  imports: [
    CommonModule
  ],
  providers:[
    { provide: PLURAL_NAMES_TOKEN, multi: true, useValue: entityConfig.pluralNames, },
  ] 
})
export class CustomerDataModule {
  constructor(private eds: EntityDefinitionService, pluralizer: Pluralizer) {    
    eds.registerMetadataMap(entityConfig.entityMetadata);
  }
}

I found an example for this here and it works if I put the provider definition into my AppModule (but nowhere else).

Upvotes: 3

Views: 263

Answers (0)

Related Questions