angularjs – 焦点打开列表
发布时间:2020-12-17 17:38:08 所属栏目:安全 来源:网络整理
导读:我使用angular bootstrap ui(typeahead)尝试在输入聚焦时显示我的客户列表,其中: lima3app.directive('typeaheadOpenOnFocus',function() { return { require: ['ngModel'],link: function(scope,element,attr,ctrls) { element.bind('focus',function() {
我使用angular bootstrap ui(typeahead)尝试在输入聚焦时显示我的客户列表,其中:
lima3app.directive('typeaheadOpenOnFocus',function() { return { require: ['ngModel'],link: function(scope,element,attr,ctrls) { element.bind('focus',function() { ctrls.$setViewValue(''); console.log('customer.customer'); }); } }; }); 所以在视图中我设置了我的输入: <input type="text" class="form-content req" id="form-customer" name="formcustomer" typeahead="customer as customer.customer for customer in customerList | filter:{customer:$viewValue}" typeahead-on-select="onCustomerSelect($item)" typeahead-append-to-body="true" typeahead-open-on-focus ng-model="customer.customer" focus="true" required="required"> 但代码,不起作用.有没有办法做到这一点? 解决方法
感谢@HenryNeo找到UI Bootstrap接受的正确属性.对于我来说,以下代码适用于angular-ui Bootstrap 1.3.3.
使用uib-typeahead启用下拉列表和typeahead-min-length(不使用uib-)以启用minLength属性. <input type="text" typeahead-min-length="0" uib-typeahead="t for t in timeZoneList"> (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |