import { Action , Store , select } from '@ngrx/store' ; import { AppState } from './app.state' ; import { Observable } from 'rxjs' ; /**
* Define an abstract class to be used by each module with store
* This can make more easeling provide generic methode to all child service.
*/ export abstract class AppStoreService { protected readonly STATE : any ; protected store : Store < AppState > ; protected storeSelectFeatureState ( ) { return this . store . pipe ( select ( this . STATE ) ) ; } protected dispatchAction ( action ) { this . store . dispatch ( action ) ; } abstract dispatchLoadAction ( options ) ; abstract dispatchCreateAction ( options ) ; abstract dispatchUpdateAction ( options ) ; abstract dispatchRemoveAction ( options ) ; }