Angular uib-typeahead无法正常工作

时间:2017-04-25 21:52:38

标签: javascript html angularjs angular-ui-bootstrap angular-ui-typeahead

我已经研究并查看了其他解决方案,但我似乎无法让它继续工作。

我的主要问题是uib-typeahead似乎根本不起作用,只需指向返回值或函数(我将在下面包含示例)。

我正在使用/继承Angular.UI.Bootstrap(v2.5.0)。

我的HTML调用(尝试使用异步和不使用)是:

 <input type="text" ng-model="selected" uib-typeahead="r.ResourceValueId as r.Value for r in ResourceValues | filter:$viewValue" class="form-control">



<input type="text" ng-model="asyncSelected" placeholder="Resources" uib-typeahead="item.ResourceValueId as item.Value for item in getResourceValuesSearch($viewValue)" 
typeahead-loading="loadingResources" typeahead-no-results="noResults" class="form-control">
<i ng-show="loadingResources" class="glyphicon glyphicon-refresh"></i>
<div ng-show="noResults">
<i class="glyphicon glyphicon-remove"></i> No Results Found</div>

这两个输入都没有出现下拉列表,并且填充了ResourceValues(使用普通&#34; select&#34;进行测试)。对于异步,它根本不调用getResourceValuesSearch()函数。

更新:我同时包含并运行了ngSanitize和ngAnimate。所以这个问题似乎与angular-ui-typeahead直接相关,因为其他一切看起来都很好。

2 个答案:

答案 0 :(得分:0)

编写一个服务来调用Api并从中获取承诺。在函数中使用服务并返回数据。

答案 1 :(得分:0)

我想出了我遇到的问题。我有ui.bootstrap的错误路径,虽然它没有返回任何错误...我仍然觉得很奇怪。

无论哪种方式,我的问题都是我的bundleConfig中ui.bootstrap的错误路径。

相关问题