@@ -135,43 +135,38 @@ The following `AppEntityServices` demonstrates.
135135
136136<code-example header =" app-entity-services.ts " >
137137import { Injectable } from '@angular/core ';
138- import { Store } from '@ngrx/store ';
139- import {
140- EntityCache,
141- EntityCollectionServiceFactory,
142- EntityServicesBase
143- } from '@ngrx/data ';
138+ import { EntityServicesBase, EntityServicesElements } from '@ngrx/data ';
144139
145140import { SideKick } from '../../model';
146141import { HeroService, VillainService } from '../../services';
147142
148143@Injectable ()
149144export class AppEntityServices extends EntityServicesBase {
150145 constructor(
151- public readonly store: Store< ; EntityCache> ; ,
152- public readonly entityCollectionServiceFactory: EntityCollectionServiceFactory,
146+ elements: EntityServicesElements,
153147
154148 // Inject custom services, register them with the EntityServices, and expose in API.
155- public readonly heroesService: HeroesService,
156- public readonly villainsService: VillainsService
149+ readonly heroesService: HeroesService,
150+ readonly villainsService: VillainsService
157151 ) {
158- super(store, entityCollectionServiceFactory );
152+ super(elements );
159153 this.registerEntityCollectionServices([ heroesService, villainsService] );
160154 }
161155
162- // ... Additional convenience members
163-
164156 /** get the (default) SideKicks service * /
165157 get sideKicksService() {
166158 return this.getEntityCollectionService< ; SideKick> ; ('SideKick');
167159 }
168160}
169161</code-example >
170162
171- ` AppEntityServices ` injects the two custom collection services, ` HeroesService ` and ` VillainsService ` ,
172- which it also exposes directly as convenience properties.
163+ ` AppEntityService ` first injects the ` EntityServicesElements ` helper which it passes straight through to the base class constructor.
164+ The "elements" enclose the ingredients that the base class needs to make and manage the entities you described in metadata.
165+
166+ Then it injects your two custom collection services, ` HeroesService ` and ` VillainsService ` ,
167+ and exposes them directly to consumers as convenience properties for accessing those services.
173168
174- There is no custom collections service for the ` SideKick ` .
169+ In this example, we don't need a custom collection service for the ` SideKick ` entity .
175170The default service will do.
176171
177172Nonetheless, we add a ` sideKicksService ` property that gets or creates a default service for ` SideKick ` .
0 commit comments