I am trying to extend the ngrx/data DefaultDataService and override some methods. What I have to change in the methods is the entityUrl and I have to send an HttpParam (to tell the interceptor which BE service should be used for the specific Http request).
So I override i.e. the getAll method like follows:
@Injectable()
export class GeneralFilterDataDirectorateService extends DefaultDataService<IDropDown> {
constructor(
http: HttpClient,
httpUrlGenerator: HttpUrlGenerator
) {
super('Directorate', http, httpUrlGenerator);
}
getAll(): Observable<Array<IDropDown>> {
return this.http
.get<Array<IDropDown>>(`url`,
{ params: new CustomHttpParams(URL_TYPES.COMMON) })
}
}
However it triggers the Http request, it does not fire any ngrx event. (data received, but not stored in the ngrx store)
The implementation works in this Udemy training "NgRx (with NgRx Data) - The Complete Guide", but not for me.
Has anyone idea what the problem might be?
Found the issue.
The GeneralFilterDataDirectorateService.GetAll() was called directly, not through the EntityCollectionServiceBase service.
The correct calling chain is: Component/Service => EntityCollectionServiceBase => DefaultDataService