diff --git a/src/typeahead/typeahead.js b/src/typeahead/typeahead.js index 6316225..ef5ff7b 100644 --- a/src/typeahead/typeahead.js +++ b/src/typeahead/typeahead.js @@ -104,7 +104,7 @@ angular.module('mm.foundation.typeahead', ['mm.foundation.position', 'mm.foundat //it might happen that several async queries were in progress if a user were typing fast //but we are interested only in responses that correspond to the current view value if (inputValue === modelCtrl.$viewValue && hasFocus) { - if (matches.length > 0) { + if (matches && matches.length > 0) { scope.activeIdx = 0; scope.matches.length = 0; @@ -304,7 +304,7 @@ angular.module('mm.foundation.typeahead', ['mm.foundation.position', 'mm.foundat scope.templateUrl = attrs.templateUrl; scope.isOpen = function () { - return scope.matches.length > 0; + return scope.matches && scope.matches.length > 0; }; scope.isActive = function (matchIdx) {