1 import { Component, EventEmitter, Output } from '@angular/core';
3 import { DROPDOWN_DIRECTIVES} from 'ng2-bootstrap/components/dropdown';
5 import { Search } from './search.model';
6 import { SearchField } from './search-field.type';
10 templateUrl: 'client/app/shared/search.component.html',
11 directives: [ DROPDOWN_DIRECTIVES ]
14 export class SearchComponent {
15 @Output() search = new EventEmitter<Search>();
17 searchCriterias: Search = {
26 magnetUri: 'Magnet Uri'
30 return Object.keys(this.fieldChoices);
33 getStringChoice(choiceKey: SearchField) {
34 return this.fieldChoices[choiceKey];
37 choose($event: MouseEvent, choice: SearchField) {
38 $event.preventDefault();
39 $event.stopPropagation();
41 this.searchCriterias.field = choice;
45 this.search.emit(this.searchCriterias);