@Component({
        selector: "autocomplete",
        pipes: [AsyncPipe],
        template: `<input [ngFormControl]="search">
        <ul>
        <li *ngFor="#suggestion of suggestions | async">
         {{ suggestion }}
        </li>
        </ul>`
        })
        export class Autocomplete {
        public search = new Control();
        public suggestions: Observable<string[]>;
        
        constructor(github: GithubSearch) {
        this.suggestions = this.search.valueChanges
        .debounceTime(400)
        .map(keyword => keyword.trim())
        .filter(keyword => keyword.length > 0)
        .distinctUntilChanged()
        .map(keyword => github.searchUsers(keyword))
        .switch();
        }
        }