fix autocompleter example in docs
This commit is contained in:
parent
bdd016de3f
commit
232b02a082
3 changed files with 42 additions and 42 deletions
|
|
@ -126,17 +126,17 @@ autocompleter.controller = function(data, getter) {
|
||||||
this.change = function(value) {
|
this.change = function(value) {
|
||||||
this.value(value);
|
this.value(value);
|
||||||
|
|
||||||
var data = value === "" ? [] : data.filter(function(item) {
|
var list = value === "" ? [] : data.filter(function(item) {
|
||||||
return this.getter(item).toLowerCase().indexOf(value.toLowerCase()) > -1;
|
return this.getter(item).toLowerCase().indexOf(value.toLowerCase()) > -1;
|
||||||
}, this);
|
}, this);
|
||||||
this.data(data);
|
this.data(list);
|
||||||
};
|
};
|
||||||
|
|
||||||
//this method is called when an option is selected. It triggers an `onchange` event
|
//this method is called when an option is selected. It triggers an `onchange` event
|
||||||
this.select = function(value) {
|
this.select = function(value) {
|
||||||
this.value(value);
|
this.value(value);
|
||||||
this.data([]);
|
this.data([]);
|
||||||
if (this.onchange) this.onchange({target: {value: value}});
|
if (this.onchange) this.onchange({currentTarget: {value: value}});
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Binary file not shown.
|
|
@ -99,17 +99,17 @@ autocompleter.controller = function(data, getter) {
|
||||||
this.change = function(value) {
|
this.change = function(value) {
|
||||||
this.value(value);
|
this.value(value);
|
||||||
|
|
||||||
var data = value === "" ? [] : data.filter(function(item) {
|
var list = value === "" ? [] : data.filter(function(item) {
|
||||||
return this.getter(item).toLowerCase().indexOf(value.toLowerCase()) > -1;
|
return this.getter(item).toLowerCase().indexOf(value.toLowerCase()) > -1;
|
||||||
}, this);
|
}, this);
|
||||||
this.data(data);
|
this.data(list);
|
||||||
};
|
};
|
||||||
|
|
||||||
//this method is called when an option is selected. It triggers an `onchange` event
|
//this method is called when an option is selected. It triggers an `onchange` event
|
||||||
this.select = function(value) {
|
this.select = function(value) {
|
||||||
this.value(value);
|
this.value(value);
|
||||||
this.data([]);
|
this.data([]);
|
||||||
if (this.onchange) this.onchange({target: {value: value}});
|
if (this.onchange) this.onchange({currentTarget: {value: value}});
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue