簡體   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