Skip to content

Instantly share code, notes, and snippets.

@ScriptBytes
Created April 21, 2021 04:03
Show Gist options
  • Save ScriptBytes/2dc2b7b18150f4b1d712b5a3e3aad7f7 to your computer and use it in GitHub Desktop.
Save ScriptBytes/2dc2b7b18150f4b1d712b5a3e3aad7f7 to your computer and use it in GitHub Desktop.
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { Person } from './person.model';
import { environment } from 'environments/environment';
import { StoreService } from 'app/core/services/store.service';
@Injectable({
providedIn: 'root'
})
export class PersonService extends StoreService<Person> {
constructor(
protected http: HttpClient
) {
super(
http,
{
// url: environment.apiUrl + 'users/', Normally you use an environment variable to point to the api url
url: 'https://jsonplaceholder.typicode.com/users/',
idField: 'id',
itemName: 'Person'
}
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment