繁体   English   中英

使用angular-ui提前输入

[英]Typeahead using angular-ui

我已经使用angular-ui库创建了typeahead。

我当前的预输入html是:

<input name="customers" id="customers" type="text" placeholder="enter a customer" ng-model="selectedCustomer" uib-typeahead="customer.firstName for customer in customers  | filter: $viewValue | limitTo:8" class="form-control" typeahead-editable="false">

基本上,typeahead搜索工作正常,但是当我选择前面的类型时,我想检索附加到客户记录的所有字段,例如姓氏,地址等。typeahead被填充到控制器中的名为$ scope.customers的属性中。通过对api的ajax调用来获得所有客户。

那么在选择时,如何获得与所选客户相关的所有字段?

干杯

更改uib-typeahead属性:

<input name="customers" id="customers" type="text" placeholder="enter a customer" ng-model="selectedCustomer" uib-typeahead="customer as customer.firstName for customer in customers  | filter: $viewValue | limitTo:8" class="form-control" typeahead-editable="false">

这会将所选客户设置为ng-model selectedCustomer

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM