From 9c6f2573d4a84c1c4b5744d9d4c9838801f33f1f Mon Sep 17 00:00:00 2001 From: Marc Sluiter Date: Wed, 30 Mar 2016 19:45:31 +0200 Subject: [PATCH] fix(typeahead): Hide typeahead popup on blur. Fixes #351 --- components/typeahead/typeahead.directive.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/components/typeahead/typeahead.directive.ts b/components/typeahead/typeahead.directive.ts index 50d6c53395..f02168d5c9 100644 --- a/components/typeahead/typeahead.directive.ts +++ b/components/typeahead/typeahead.directive.ts @@ -262,6 +262,11 @@ export class Typeahead implements OnInit { } } + @HostListener('blur', ['$event.target']) + onblur() { + this.hide(); + } + public changeModel(value:any) { let valueStr:string = ((typeof value === 'object' && this.typeaheadOptionField) ? value[this.typeaheadOptionField] : value).toString(); this.cd.viewToModelUpdate(valueStr);