大佬教程收集整理的这篇文章主要介绍了angularjs – 如何清除从AngularUI typeahead输入的文本,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
<input id="searchTextBoxId" type="text" ng-model="asyncSELEcted" placeholder="Search addresses..." typeahead="address for address in getLOCATIOn($viewvalue) | filter:$viewValue" typeahead-loading="loadingLOCATIOns" class="form-control" typeahead-on-SELEct="SELEctMatch(asyncSELEcted)" typeahead-min-length="3" typeahead-wait-ms="500">
我试图使用它的Id设置Input元素的文本值和占位符值,但是没有工作,例如这些:
// the input text was still the $('#searchTextBoxId').attr('placeholder','HelLO');
选择结果
// the input text was still the SELEcted result $('#searchTextBoxId').val('');
如何设置或重置文本值?
我最终设置NgModel为typeahead-on-SELEct属性中的一个空字符串:
在您的typeahead-on-SELEct属性中,添加asyncSELEcted =”;在你的SELEct函数后面,像这样:
<input ... typeahead-on-SELEct="SELEctMatch(asyncSELEcted); asyncSELEcted = '';" />
<input id="searchTextBoxId" type="text" ng-model="asyncSELEcted" placeholder="Search addresses..." typeahead="address for address in getLOCATIOn($viewvalue) | filter:$viewValue" typeahead-loading="loadingLOCATIOns" class="form-control" typeahead-on-SELEct="SELEctMatch(asyncSELEcted); asyncSELEcted = '';" typeahead-min-length="3" typeahead-wait-ms="500">
以上是大佬教程为你收集整理的angularjs – 如何清除从AngularUI typeahead输入的文本全部内容,希望文章能够帮你解决angularjs – 如何清除从AngularUI typeahead输入的文本所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。