我试图让uib-typeahead显示地址列表,并且无法为其编写循环。
控制器功能:
$scope.addresses = function(address) {
$http.get(config
.apiUrl +
'addressvalidation/validateaddress?address1=' +
address).then(function (response) {
//alert(response.data.matchedAddressResults[0].formattedAddress);
return response.data.matchedAddressResults;
});
};
matchedAddressResults是一个对象数组(例如"地址":" 123,st。")
预先输入代码:
uib-typeahead="item as item.address for item in addresses($viewValue) | filter:$viewValue:startsWith | limitTo:8"
typeahead-min-length="12">
如何正确编写循环?