Project

General

Profile

1
import {Component, Input, Output, EventEmitter} from '@angular/core';
2
import {Observable}       from 'rxjs/Observable';
3

    
4
@Component({
5
    selector: 'search-form',
6
    template: `
7

    
8
        <form [class]="(isDisabled)?'uk-margin uk-text-center uk-margin-top uk-disabled':'uk-margin uk-text-center uk-margin-top'">
9
                 <input type="text" class="uk-input  uk-width-1-2" [placeholder]="placeholderText" aria-describedby="sizing-addon2"  [(ngModel)]="keyword"  name="keyword" >
10
                    <button (click)="keywordChanged()"  type="submit" class=" uk-button uk-button-default"><span class="uk-icon">
11
<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="search" ratio="1"><circle fill="none" stroke="#000" stroke-width="1.1" cx="9" cy="9" r="7"></circle><path fill="none" stroke="#000" stroke-width="1.1" d="M14,14 L18,18 L14,14 Z"></path></svg>
12
</span>Search</button>
13
        </form>
14

    
15

    
16
    `
17
})
18

    
19
export class SearchFormComponent {
20
    @Input() isDisabled: boolean = false;
21
    @Input() keyword: string = '';
22
    @Input() generalSearch: boolean = false;
23
    @Input() placeholderText: string = "Type keywords";
24

    
25
    @Output() keywordChange  = new EventEmitter();
26

    
27
    constructor () {
28
     }
29

    
30
    ngOnInit() {
31

    
32
    }
33

    
34
    keywordChanged() {
35
        console.info("inside form: "+this.keyword);
36
        this.keywordChange.emit({
37
            value: this.keyword
38
        });
39
    }
40
}
(15-15/28)