Add category service in Angular2.
This commit is contained in:
22
src/operations/category.service.ts
Normal file
22
src/operations/category.service.ts
Normal 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
|
||||
});
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user