Angular uib-typeahead 工作不正常
Angular uib-typeahead is not working correctly
我已经研究并查看了其他解决方案,但我似乎无法让它继续工作。
我的主要问题是 uib-typeahead 似乎根本不起作用,要么只是指向一个 return 值,要么指向一个函数(我将在下面包括示例) .
我是using/inheriting 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(使用正常 "select" 进行测试)。对于异步,它根本不调用 getResourceValuesSearch() 函数。
更新:我在模块中包含了 ngSanitize 和 ngAnimate 以及 运行。所以这个问题似乎与 angular-ui-typeahead 直接相关,因为其他一切似乎都工作正常。
编写调用 Api 的服务并从中获取承诺。在您的函数和 return 数据中使用服务。
我发现了我遇到的问题。我的 ui.bootstrap 路径不正确,虽然它没有 return 任何错误...我仍然觉得很奇怪。
无论如何,我的问题是我的 bundleConfig 中 ui.bootstrap 的路径错误。
我已经研究并查看了其他解决方案,但我似乎无法让它继续工作。
我的主要问题是 uib-typeahead 似乎根本不起作用,要么只是指向一个 return 值,要么指向一个函数(我将在下面包括示例) .
我是using/inheriting 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(使用正常 "select" 进行测试)。对于异步,它根本不调用 getResourceValuesSearch() 函数。
更新:我在模块中包含了 ngSanitize 和 ngAnimate 以及 运行。所以这个问题似乎与 angular-ui-typeahead 直接相关,因为其他一切似乎都工作正常。
编写调用 Api 的服务并从中获取承诺。在您的函数和 return 数据中使用服务。
我发现了我遇到的问题。我的 ui.bootstrap 路径不正确,虽然它没有 return 任何错误...我仍然觉得很奇怪。
无论如何,我的问题是我的 bundleConfig 中 ui.bootstrap 的路径错误。