Skip to content

Commit

Permalink
Merge pull request #346 from slintes/typeahead-undefined
Browse files Browse the repository at this point in the history
Fixed potential error if value of typeahead is undefined. Fixes #345
  • Loading branch information
valorkin committed Mar 30, 2016
2 parents 260e963 + aeb2bc1 commit c8a94a3
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions components/typeahead/typeahead.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,13 @@ export class Typeahead implements OnInit {
}

private processMatches() {

this._matches = [];

if (!this.typeahead) {
return;
}

// If singleWords, break model here to not be doing extra work on each iteration
let normalizedQuery = (this.typeaheadLatinize ? TypeaheadUtils.latinize(this.cd.model) : this.cd.model).toString().toLowerCase();
normalizedQuery = this.typeaheadSingleWords ? TypeaheadUtils.tokenize(normalizedQuery, this.typeaheadWordDelimiters, this.typeaheadPhraseDelimiters) : normalizedQuery;
Expand Down

0 comments on commit c8a94a3

Please sign in to comment.