Skip to content

Commit 9cbccd2

Browse files
committed
refactoring
1 parent 9458ac1 commit 9cbccd2

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/directives/typeahead.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ angular.module('$strap.directives')
3939
// Bootstrap override
4040
var typeahead = element.data('typeahead');
4141
// Fixes #2043: allows minLength of zero to enable show all for typeahead
42-
typeahead.lookup = function (ev) {
42+
typeahead.lookup = function(ev) {
4343
var items;
4444
this.query = this.$element.val() || '';
4545
if (this.query.length < this.options.minLength) {
@@ -49,9 +49,10 @@ angular.module('$strap.directives')
4949
return items ? this.process(items) : this;
5050
};
5151

52-
if(attrs.matchall === "true") {
53-
// return true on every server side sugg
54-
typeahead.matcher = function (item) {
52+
var matchAll = element.data('data-match-all');
53+
if(typeof(matchAll) != 'undefined' && matchAll === "true") {
54+
// Return true on every item, for example if the dropdown is populated with server-side sugggestions
55+
typeahead.matcher = function(item) {
5556
return true;
5657
};
5758
}

0 commit comments

Comments
 (0)