我的AngularUI引導程序typeahead返回「No Results Found」,即使它應該讀取對象數組。AngularUI Bootstrap typeahead顯示「No Results」而不是下拉對象
在UIB-預輸入我uib-typeahead="number for number in getNumbers($viewValue)"
,並在我的控制器我有
$scope.getNumbers = function($viewValue) {
...stuff to retrieve numbers...
return array
}
其中console.log(array)
顯示[對象,對象,對象...]
我只是想以顯示我認爲相關的代碼位。這是問題所在嗎?爲什麼下拉菜單返回未找到結果?
<input
type="text"
class="form-control"
name="number"
ng-model="numberinfo.number"
uib-typeahead="number for number in getNumbers($viewValue)"
typeahead-template-url="/tpl.html"
typeahead-loading="Loadinglocations"
typeahead-on-select="numberSelect($item, 10)"
typeahead-wait-ms="3"
typeahead-min-length="3"
typeahead-no-results="noResults"
required>
<i ng-show="loadingLocations" class="glyphicon glyphicon-refresh">Loading...</i>
<div ng-show="noResults">
<i class="glyphicon glyphicon-remove"></i> No Results Found.
</div>
<script type="text/ng-template" id="/tpl.html">
<a>
<div>
<span style="display:block;" class="registration"
ng-bind-html="match.model.number | uibTypeaheadHighlight:query"></span>
</div>
</a>
</script>
你可以嘗試闡述的你的問題創建一個[Plunker](http://plnkr.co),以便我們可以看到你有問題? – luixaviles
你能顯示一些控制器代碼嗎? – Wcan