试图让 UI 引导 uib-typeahead 在搜索栏异步上工作。 我得到了正确的数据响应,一个对象数组:
[ { username: 'yaboi' },
{ username: 'Gepeto' },
{ username: 'Zanbato' },
{ username: 'Colonel' },
{ username: 'Hipster' },
{ username: 'jacob' } ]
但它似乎没有过滤或与 UIB 类型提前一起使用。 仅使用typeahead,虽然我可以得到响应,但它没有正确过滤掉,我很确定它已贬值,因为它在控制台中抛出警告,指出成功不是一个函数。
我的循环有问题吗?
<input id="giftUser" ng-model="asyncSelected" class="form-control" type="text" autocomplete="off" placeholder="Search Users" uib-typeahead="username for username in getUsers($viewValue)" typeahead-loading="loadingUsers" typeahead-no-results="noResults">
<i ng-show="loadingUsers" class="glyphicon glyphicon-refresh"></i>
<div ng-show="noResults">
<i class="glyphicon glyphicon-remove"></i> No Results Found
</div>
我想
我想通了 - 我使用的是旧版本的 ui-bootstrap。 0.14 之后的所有内容都需要 uib,在此之前的所有内容都不需要。