import { HttpClient } from '@angular/common/http' ; import { Injectable , Optional } from '@angular/core' ; import { Observable } from 'rxjs' ; import { Hero , ToastService } from '../core' ; import { DataService , DataServiceConfig } from './data.service' ; import { HttpUrlGenerator } from './http-url-generator' ; /**
 * Heroes HTTP DataService
 * Wraps and exposes the protected base DataService CRUD methods
 */ @ Injectable ( ) export class HeroesDataService extends DataService < Hero > { constructor ( http , httpUrlGenerator , @ Optional ( ) toastService , @ Optional ( ) config ) { super ( 'Hero' , http , httpUrlGenerator , toastService , config ) ; } /** Add entity to the database. Update entities$. */ add ( entity ) { return this . _add ( entity ) ; } /** Delete entity-by-id from the database. Update entities$. */ delete ( id ) { return this . _delete ( id ) ; } /** Get all entities from the database. Update entities$ and loading$ indicator. */ getAll ( ) { return this . _getAll ( ) ; } /** Update the entity in the database.  Update entities$. */ update ( entity ) { return this . _update ( entity ) ; } }