import {Component, Input} from '@angular/core'; import {RouterHelper} from '../../utils/routerHelper.class'; 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['class']}}
{{item['name']}} {{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, "id": string, "date": string, "percentage": number, "class": string}[];//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; } }