0

我的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> 
+0

你可以嘗試闡述的你的問題創建一個[Plunker](http://plnkr.co),以便我們可以看到你有問題? – luixaviles

+0

你能顯示一些控制器代碼嗎? – Wcan

回答

0

控制器被安慰的對象,但你UIB-typehead但未得到其可能是因爲這個參數

$scope.getNumbers = function($viewValue) 

將其更改爲

$scope.getNumbers = function(viewValue) 
+0

這並沒有改變任何東西。輸出是相同的,並且「未找到結果」消息仍然顯示。 – jenryb

+0

比我想你會得到一個笨蛋來理解你的控制代碼,我希望你會在那之後得到答案 – Wcan