Don't clear search box on search page when a new query is submitted

Users want to be able to see the current query
This commit is contained in:
Joseph Schorr 2017-05-03 15:35:24 -04:00
parent 19f67bfa1b
commit 17c4d4c84e
3 changed files with 4 additions and 4 deletions

View file

@ -38,13 +38,12 @@
</span>
</div>
</script>
<input class="form-control" type="text" placeholder="search"
ng-model="$ctrl.enteredQuery"
typeahead="$ctrl.onTypeahead($event)"
ta-display-key="name"
ta-suggestion-tmpl="search-result-template"
ta-clear-on-select="true"
ta-clear-on-select="$ctrl.clearOnSearch"
(ta-selected)="$ctrl.onSelected($event)"
(ta-entered)="$ctrl.onEntered($event)">
<span class="search-icon">

View file

@ -10,6 +10,7 @@ import { Input, Component, Inject } from 'ng-metadata/core';
})
export class SearchBoxComponent {
@Input('<query') public enteredQuery: string = '';
@Input('@clearOnSearch') public clearOnSearch: string = 'true';
private isSearching: boolean = false;
private currentQuery: string = '';
@ -48,7 +49,7 @@ export class SearchBoxComponent {
private onEntered($event): void {
this.$timeout(() => {
$event['callback'](true); // Clear the value.
$event['callback'](this.clearOnSearch == 'true'); // Clear the value.
this.$location.url('/search');
this.$location.search('q', $event['value']);
}, 10);

View file

@ -1,6 +1,6 @@
<div class="cor-container search">
<div class="search-top-bar">
<search-box query="currentQuery"></search-box>
<search-box query="currentQuery" clear-on-search="false"></search-box>
</div>
<div class="search-results-section">