import { Input, Component, Inject } from 'ng-metadata/core'; /** * A component that displays a search box with autocomplete. */ @Component({ selector: 'search-box', templateUrl: '/static/js/directives/ui/search-box/search-box.component.html', }) export class SearchBoxComponent { @Input(' { if (this.currentQuery == $event['query']) { $event['callback'](resp.results); this.autocompleteSelected = false; } }); } private onSelected($event): void { this.autocompleteSelected = true; this.$timeout(() => { this.$location.url($event['result']['href']) }, 100); } private onEntered($event): void { this.$timeout(() => { $event['callback'](true); // Clear the value. this.$location.url('/search'); this.$location.search('q', $event['value']); }, 10); } }