NetanelBasal
6/10/2018 - 2:04 PM

product.model.ts

import { ID } from '@datorama/akita';

export type Product = {
  id: ID;
  title: string;
  description: string;
  price: number;
};
import { ProductsStore, State } from './products.store';
import { Product } from './products.model';
import { QueryEntity } from '@datorama/akita';

@Injectable({
  providedIn: 'root'
})
export class ProductsQuery extends QueryEntity<State, Product> {
  constructor(protected store: ProductsStore) {
    super(store);
  }
}
import { Product } from './products.model';
import { EntityState, EntityStore } from '@datorama/akita';

export interface State extends EntityState<Product> {}

@Injectable({
  providedIn: 'root'
})
export class ProductsStore extends EntityStore<State, Product> {
  constructor() {
    super();
  }
}