import {Component, Input, Output, EventEmitter} from '@angular/core'; import {Observable} from 'rxjs/Observable'; import {RouterHelper} from '../../utils/routerHelper.class'; import {Router} from '@angular/router'; @Component({ selector: 'search-form', template: `
` }) export class SearchFormComponent { @Input() isDisabled: boolean = false; @Input() keyword: string = ''; @Input() generalSearch: boolean = false; @Input() placeholderText: string = "Type keywords"; @Input() link: boolean = false; public routerHelper:RouterHelper = new RouterHelper(); @Output() keywordChange = new EventEmitter(); constructor (private _router:Router) { } ngOnInit() { } keywordChanged() { console.info("inside form: "+this.keyword); this.keywordChange.emit({ value: this.keyword }); } goTo() { this._router.navigate(['/search/find'], { queryParams: this.routerHelper.createQueryParam('keyword',this.keyword) }); } }