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: EventEmitter<Search> = new EventEmitter<Search>();
17 searchCriterias: Search = {
25 magnetUri: 'Magnet Uri'
29 return Object.keys(this.fieldChoices);
32 getStringChoice(choiceKey: SearchField): string {
33 return this.fieldChoices[choiceKey];
36 choose($event:MouseEvent, choice: SearchField) {
37 $event.preventDefault();
38 $event.stopPropagation();
40 this.searchCriterias.field = choice;
44 this.search.emit(this.searchCriterias);