From c0beddba14d5e1caca1dde298e08b390e7f91fd7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Madej?= Date: Thu, 29 Jul 2021 19:54:05 +0200 Subject: [PATCH] fix(typeahead): need to check if `_matches` is not undefined in the `blur` handler (#6028) fix(typeahead): need to check if `_matches` is not undefined in the `blur` handler (#6028) Co-authored-by: lukasz-madej Co-authored-by: Dmitriy Shekhovtsov Co-authored-by: Dmitriy Danilov --- src/typeahead/typeahead.directive.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/typeahead/typeahead.directive.ts b/src/typeahead/typeahead.directive.ts index 6c9b0043cd..bc7a7af9d7 100644 --- a/src/typeahead/typeahead.directive.ts +++ b/src/typeahead/typeahead.directive.ts @@ -322,10 +322,10 @@ export class TypeaheadDirective implements OnInit, OnDestroy { this.typeaheadOnBlur.emit(this._container.active); } - if (!this.container && this._matches.length === 0) { + if (!this.container && this._matches?.length === 0) { this.typeaheadOnBlur.emit(new TypeaheadMatch( this.element.nativeElement.value, - this.element.nativeElement.value, + this.element.nativeElement.value, false)); } }