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:
		
							parent
							
								
									19f67bfa1b
								
							
						
					
					
						commit
						17c4d4c84e
					
				
					 3 changed files with 4 additions and 4 deletions
				
			
		|  | @ -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"> | ||||
|  |  | |||
|  | @ -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); | ||||
|  |  | |||
|  | @ -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"> | ||||
|  |  | |||
		Reference in a new issue