Skip to content

Commit fa6f174

Browse files
authored
fix(typeahead): dont throw error if latinize is off and no value for input (#4480)
fixes #4465
1 parent 86dd8e8 commit fa6f174

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/typeahead/typeahead.directive.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -433,12 +433,12 @@ export class TypeaheadDirective implements OnInit, OnDestroy {
433433
}
434434

435435
if (this._container) {
436-
// This improves the speed as it won't have to be done for each list item
437-
const normalizedQuery = (this.typeaheadLatinize
436+
// fix: remove usage of ngControl internals
437+
const _controlValue = (this.typeaheadLatinize
438438
? latinize(this.ngControl.control.value)
439-
: this.ngControl.control.value)
440-
.toString()
441-
.toLowerCase();
439+
: this.ngControl.control.value) || '';
440+
// This improves the speed as it won't have to be done for each list item
441+
const normalizedQuery = _controlValue.toString().toLowerCase();
442442
this._container.query = this.typeaheadSingleWords
443443
? tokenize(
444444
normalizedQuery,

0 commit comments

Comments
 (0)