Trying to understand the ngrx/data entity data service example here, where it says "Creating entity data services". After showing that service, the docs go on to show how to use ngrx/data in components. The part of the component I'm interested in is this:
getHeroes() {
this.heroService.getAll();
}
The docs state that getAll()
initiates an HTTP request, but I'm not sure where or how this request is actually made. In the ngrx-data repo. It states to replace the heroService with the following code:
import { Injectable } from '@angular/core';
import {
EntityCollectionServiceBase,
EntityCollectionServiceElementsFactory
} from 'ngrx-data';
import { Hero } from '../core';
@Injectable({ providedIn: 'root' })
export class HeroService extends EntityCollectionServiceBase<Hero> {
constructor(serviceElementsFactory: EntityCollectionServiceElementsFactory) {
super('Hero', serviceElementsFactory);
}
}
The docs state ngrx-data handles getting and saving our data for us
. That's great, but I don't know where this getting data is happening. I cloned the repo, checked out the finish
branch and could not find something that is hitting endpoints.
E.g. the service used to call http.get(${api}/heroes)
for getAll()
to get all the heroes, but that's replaced by the above code, so where are these calls occurring?
I notice that the EntityCollectionServiceBase
has a getAll()
method. But where is the configuration of this service taking place to register the respective endpoints? I'm sure that I am missing something incredibly simple here.