mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
Blur live search input after emiting 'search' event
- Ensures that the drop-down disappears from screen Refs #228
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
</label>
|
||||
<div [class]="getTextFieldHolderClassName()">
|
||||
<input class="mdl-textfield__input" [type]="inputType" [autocomplete]="getAutoComplete()" data-automation-id="search_input"
|
||||
id="searchControl" [ngFormControl]="searchControl" [(ngModel)]="searchTerm" (focus)="onFocus($event)"
|
||||
#searchInput id="searchControl" [ngFormControl]="searchControl" [(ngModel)]="searchTerm" (focus)="onFocus($event)"
|
||||
(blur)="onBlur($event)">
|
||||
<label class="mdl-textfield__label" for="searchControl">{{'SEARCH.CONTROL.LABEL' | translate}}</label>
|
||||
</div>
|
||||
|
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
|
||||
import { Control, Validators } from '@angular/common';
|
||||
import { Component, Input, Output, EventEmitter, AfterViewInit } from '@angular/core';
|
||||
import { Component, Input, Output, ElementRef, EventEmitter, AfterViewInit, ViewChild } from '@angular/core';
|
||||
import { AlfrescoPipeTranslate, AlfrescoTranslationService } from 'ng2-alfresco-core';
|
||||
import { AlfrescoSearchAutocompleteComponent } from './alfresco-search-autocomplete.component';
|
||||
|
||||
@@ -58,6 +58,8 @@ export class AlfrescoSearchControlComponent implements AfterViewInit {
|
||||
|
||||
searchControl: Control;
|
||||
|
||||
@ViewChild('searchInput', {}) searchInput: ElementRef;
|
||||
|
||||
@Input()
|
||||
autocompleteSearchTerm = '';
|
||||
|
||||
@@ -114,7 +116,7 @@ export class AlfrescoSearchControlComponent implements AfterViewInit {
|
||||
this.searchChange.emit({
|
||||
value: this.searchTerm
|
||||
});
|
||||
// this.router.navigate(['Search', term]);
|
||||
this.searchInput.nativeElement.blur();
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user