角xeditable预输入默认显示所有项目时,键盘缓冲是空的 [英] angular xeditable typeahead show all items by default when typeahead is empty
问题描述
使用angularjs xeditable预输入,我们怎么默认显示所有项目时,键盘缓冲是空的。
Using angularjs xeditable typeahead, how do we show all items by default when typeahead is empty.
在angularjs xeditable预输入电流的例子是在 http://vitalets.github.io/角xeditable /#预输入
Current example of the angularjs xeditable typeahead is at http://vitalets.github.io/angular-xeditable/#typeahead
推荐答案
我通过更改UI的引导,第三方物流企业,0.10.0.js一些code得到了有效的解决方案。
因此,有在预输入HTML标记没有区别。
I got a working solution by changing some code in ui-bootstrap-tpls-0.10.0.js. So there are no differences in the typeahead html markup.
您可以看看 http://plnkr.co/edit/CutBFE p = preVIEW
要使用此修复程序,使用UI自举 - 第三方物流企业 - 0.10.0.js从普拉克。
看到我的变化,从普拉克开放的用户界面,引导,第三方物流企业,0.10.0.js和搜索'ahneo。
To use this fix, use the ui-bootstrap-tpls-0.10.0.js from the Plunk. To see my changes, open ui-bootstrap-tpls-0.10.0.js from the Plunk and search for 'ahneo'.
1. //minimal no of characters that needs to be entered before typeahead
kicks-in
// ahneo :: before
//var minSearch = originalScope.$eval(attrs.typeaheadMinLength) || 1;
// ahneo :: after (changed minimal no of characters to 0 by default)
var minSearch = originalScope.$eval(attrs.typeaheadMinLength) || 0;
2. // ahneo :: new (set input value to empty string if it contains " " string value)
if (inputValue === ' ') {
inputValue = '';
modelCtrl.$setViewValue('');
}
3. // ahneo :: before
//if (inputValue && inputValue.length >= minSearch) {
// ahneo :: after (add new condition to get matches for min search = 0)
if (minSearch === 0 || inputValue && inputValue.length >= minSearch) {
4. // ahneo :: new (bind element to focus event to trigger modelCtrl.$parsers.unshift method)
element.bind('focus', function (evt) {
if (modelCtrl.$viewValue === '') {
modelCtrl.$setViewValue(' ');
}
});
希望这有助于
这篇关于角xeditable预输入默认显示所有项目时,键盘缓冲是空的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!