1 import { Injectable } from '@angular/core';
2 import { URLSearchParams } from '@angular/http';
4 import { RestPagination } from './rest-pagination';
7 export class RestService {
9 buildRestGetParams(pagination?: RestPagination, sort?: string) {
10 const params = new URLSearchParams();
13 const start: number = (pagination.currentPage - 1) * pagination.itemsPerPage;
14 const count: number = pagination.itemsPerPage;
16 params.set('start', start.toString());
17 params.set('count', count.toString());
21 params.set('sort', sort);