UNPKG

angular2-simple-ui

Version:

Angular 2 Simple Material Design UI Components customisable with Simple 30 KB CSS with LESS support and full features support , just plugin up and run for clarity look at sample examples

15 lines (13 loc) 425 B
import { PipeTransform, Pipe } from '@angular/core'; @Pipe({ name: 'pagination' }) export class PagingPipe implements PipeTransform { transform(items: any[], currentPage: number, pageSize: number): any { let from = (currentPage - 1) * pageSize; let to = pageSize * currentPage; if (to > items.length) to = items.length; return items.slice(from, to); } }