import { Pipe, PipeTransform } from '@angular/core';
@Pipe({
name: 'pagerPipe'
})
export class PagerPipe implements PipeTransform {
transform(array: any[], pager: Pager): any {
var start = (pager.activePage-1)*pager.pageSize;
var end = pager.activePage*pager.pageSize;
console.log(start,end);
return array.slice(start,end);
}
};
//--------------------------------------------------------------------------
export class Pager {
pageSize:number;
activePage:number;
};
It works just fine when I set the arguments to have individual pageSize and activePage, But when I pass a class that has both pageSize and pageNumber, the pipe doesnt detect argument changes
Unfortunately Im using angular-cli via ng build and "plunker" wont let me upload vendor.bundle.js saying "save failed"
http://www.mediafire.com/file/2ndirjwkhgq06gq/Test.zip unzip and run index.html
By the way, Id like to avoid using Impure pipes.