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/search.component.html',
11 directives: [ DROPDOWN_DIRECTIVES ]
14 export class SearchComponent {
15 @Output() search = new EventEmitter<Search>();
21 magnetUri: 'Magnet Uri'
23 searchCriterias: Search = {
29 return Object.keys(this.fieldChoices);
32 choose($event: MouseEvent, choice: SearchField) {
33 $event.preventDefault();
34 $event.stopPropagation();
36 this.searchCriterias.field = choice;
40 this.search.emit(this.searchCriterias);
43 getStringChoice(choiceKey: SearchField) {
44 return this.fieldChoices[choiceKey];