Add category service in Angular2.

This commit is contained in:
Alexis Lahouze
2017-07-29 16:33:24 +02:00
parent 2812891b23
commit a6a7c1cd77
4 changed files with 36 additions and 0 deletions

View File

@ -0,0 +1,22 @@
// vim: set tw=80 ts=2 sw=2 sts=2:
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs/Rx';
import { Restangular } from "ngx-restangular";
import { Category } from './category';
@Injectable()
export class CategoryService {
constructor(
private restangular: Restangular
) {}
query(id: number, minDate: Date = null, maxDate: Date = null): Observable<Category[]> {
return this.restangular.one('account', id).getList('category', {
begin: minDate,
end: maxDate
});
}
}