openaire-library/claims/linking/selected/selectedResults.component.ts

31 lines
733 B
TypeScript

import {Component, Input} from '@angular/core';
import {ClaimEntity} from '../../claim-utils/claimHelper.class';
@Component({
selector: 'claim-selected-results',
templateUrl: 'selectedResults.component.html'
})
export class ClaimSelectedResultsComponent {
@Input() results: ClaimEntity[];
@Input() sectionTitle: string = "Research Results";
@Input() localStoragePrefix: string = "";
@Input() enableRemove:boolean = true;
ngOnInit() {
}
remove(item: any) {
const index: number = this.results.indexOf(item);
if (index > -1) {
this.results.splice(index, 1);
if (this.results != null) {
localStorage.setItem(this.localStoragePrefix, JSON.stringify(this.results));
}
}
}
}