import {Component, Input} from '@angular/core'; import {RouterHelper} from '../../utils/routerHelper.class'; //import {PagingModule} from '../utils/paging.module'; import{EnvProperties} from '../../utils/properties/env-properties'; @Component({ selector: 'tabTable', template: `
{{info.length | number}} research results, page {{page | number}} of {{totalPages(info.length) | number}}
{{item['name']}} {{item['name']}} {{item['name']}}

{{item['name']}}

({{item['date']}})
{{item['percentage']}}%

No {{percentageName}} available

` }) export class TabTableComponent { @Input() percentageName: string = "Trust"; @Input() info: { "name": string, "url": string, "date": string, "percentage": number}[];//Map; @Input() properties:EnvProperties; public routerHelper:RouterHelper = new RouterHelper(); public searchLinkToPublication: string; public searchLinkToDataset: string; public page: number = 1; public pageSize: number = 10; constructor () { } ngOnInit() { this.searchLinkToPublication = this.properties.searchLinkToPublication; this.searchLinkToDataset = this.properties.searchLinkToDataset; } totalPages(totalResults: number): number { let totalPages:any = totalResults/this.pageSize; if(!(Number.isInteger(totalPages))) { totalPages = (parseInt(totalPages, this.pageSize) + 1); } return totalPages; } updatePage($event) { this.page = $event.value; } }