我使用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">
但代码,不起作用.有没有办法做到这一点?