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