import {Component, Input, Output, EventEmitter} from '@angular/core'; import { ActivatedRoute } from '@angular/router'; import {ClaimResult} from '../claim-utils/claimEntities.class'; declare var UIkit:any; @Component({ selector: 'claim-results', template:` `, }) export class ClaimResultsComponent { @Input() results; @Input() selectedResults; private isSelected(id:string){ var found:boolean = false; for (var _i = 0; _i < this.selectedResults.length; _i++) { let item = this.selectedResults[_i]; if(item.id == id){ found=true; } } return found; } add(item){ var found:boolean = this.isSelected( item.id); if (!found) { this.selectedResults.push(item); UIkit.notification({ message : 'A new research result is selected.', status : 'primary', timeout : 1000, pos : 'top-center' }); }else{ UIkit.notification({ message : 'The research result is already on your list.', status : 'warning', timeout : 1000, pos : 'top-center' }); } } }