Nav apraksta

customerservice.ts 885B

12345678910111213141516171819202122232425262728293031
  1. import { HttpClient } from '@angular/common/http';
  2. import { Injectable } from '@angular/core';
  3. import { Customer } from '../domain/customer';
  4. @Injectable()
  5. export class CustomerService {
  6. constructor(private http: HttpClient) { }
  7. getCustomersSmall() {
  8. return this.http.get<any>('assets/demo/data/customers-small.json')
  9. .toPromise()
  10. .then(res => res.data as Customer[])
  11. .then(data => data);
  12. }
  13. getCustomersMedium() {
  14. return this.http.get<any>('assets/demo/data/customers-medium.json')
  15. .toPromise()
  16. .then(res => res.data as Customer[])
  17. .then(data => data);
  18. }
  19. getCustomersLarge() {
  20. return this.http.get<any>('assets/demo/data/customers-large.json')
  21. .toPromise()
  22. .then(res => res.data as Customer[])
  23. .then(data => data);
  24. }
  25. }

Powered by TurnKey Linux.