I'm using Angular 13 with NgRx/data and entities (v 13). I have defined the following data service, in which I wish to override the URL used to retrieve entities ...
export class MyObjectService extends DefaultDataService<MyObject> {
...
getAll(): Observable<FinanceCustomer[]> {
return this.http.get('http://localhost:8085/myapi/myobjects').pipe(
map((response: any) => {
...
return data;
})
);
}
This all works well but I'm curious if I can clean this up a little. If I override another method, I would prefer not to hard-code the base URL, "http://localhost:8081/myapi/" twice (once in getAll()
and once in the other method). Is there somewhere where NgRx/data allows me to define a custom base URL for the service, and then I can reference that in subsequent service calls that I'm overriding?