1 import { Component, EventEmitter, Output } from '@angular/core';
2 import { RouteConfig, ROUTER_DIRECTIVES, ROUTER_PROVIDERS, Router } from '@angular/router-deprecated';
3 import { HTTP_PROVIDERS } from '@angular/http';
5 import { DROPDOWN_DIRECTIVES} from 'ng2-bootstrap/components/dropdown';
7 import { Search, SearchField } from './search';
10 selector: 'my-search',
11 templateUrl: 'app/angular/app/search.component.html',
12 directives: [ DROPDOWN_DIRECTIVES ]
15 export class SearchComponent {
16 @Output() search: EventEmitter<Search> = new EventEmitter<Search>();
18 searchCriterias: Search = {
26 magnetUri: "Magnet Uri"
30 return Object.keys(this.fieldChoices);
33 getStringChoice(choiceKey: SearchField): string {
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);