import {Component, Input} from '@angular/core'; import {Router} from '@angular/router'; import {DomSanitizer} from '@angular/platform-browser'; //Usage Example import {RouterHelper} from './routerHelper.class'; @Component({ selector: 'paging', template: ` ` }) export class PagingFormatter { @Input() currentPage: number = 1; @Input() size: number=10; @Input() totalResults: number = 10; @Input() baseUrl:string=""; @Input() parameterNames:string[]; @Input() parameterValues:string[]; public routerHelper:RouterHelper = new RouterHelper(); constructor ( private _router: Router, private sanitizer:DomSanitizer) { } ngOnInit() { } getTotalPages(){ var i:number =parseInt(''+(this.totalResults/this.size)); return (((this.totalResults/this.size) == i )? i :(i+1)) ; } // onPage(pageNum: number){ // return this.sanitizer.bypassSecurityTrustUrl( this.baseUrl+((this.baseUrl.indexOf("?") > -1 )?'&':'?')+ "page=" + (pageNum)); // // } }