import {Component, Input, Output, EventEmitter} from '@angular/core'; 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: string = ""; @Input() setFormCentered: boolean = true; 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) }); this._router.navigate([this.link], { queryParams: this.routerHelper.createQueryParam('keyword',this.keyword) }); } }