From ab0c31bfee6dc72918f1c9fcb3939a27d93b5cd7 Mon Sep 17 00:00:00 2001 From: Dmitriy Shekhovtsov Date: Thu, 5 Jul 2018 15:01:36 +0300 Subject: [PATCH] fix(typeahead): dont throw error if latinize is off and no value for input fixes #4465 --- src/typeahead/typeahead.directive.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/typeahead/typeahead.directive.ts b/src/typeahead/typeahead.directive.ts index d328f471ed..2e79f4cda7 100644 --- a/src/typeahead/typeahead.directive.ts +++ b/src/typeahead/typeahead.directive.ts @@ -433,12 +433,12 @@ export class TypeaheadDirective implements OnInit, OnDestroy { } if (this._container) { - // This improves the speed as it won't have to be done for each list item - const normalizedQuery = (this.typeaheadLatinize + // fix: remove usage of ngControl internals + const _controlValue = (this.typeaheadLatinize ? latinize(this.ngControl.control.value) - : this.ngControl.control.value) - .toString() - .toLowerCase(); + : this.ngControl.control.value) || ''; + // This improves the speed as it won't have to be done for each list item + const normalizedQuery = _controlValue.toString().toLowerCase(); this._container.query = this.typeaheadSingleWords ? tokenize( normalizedQuery,