0

我试图限制 Angular Bootstrap Typeahead 在执行异步调用时返回的结果数量,但它根本不起作用。

<input type="text" ng-model="asyncSelected" 
placeholder="Locations loaded via $http" typeahead="address for address in getLocation($viewValue) | limitTo:3" 
typeahead-loading="loadingLocations" class="form-control">

limitTo:3在 Plunker 示例中添加以对其进行测试,但它不起作用,有没有办法做到这一点,或者这是 Typeahead 中的错误?

plnkr

4

1 回答 1

0

我认为预输入过滤器不适用于异步调用。看到这个线程:https ://github.com/angular-ui/bootstrap/issues/993

它可能不那么优雅,但您可以在获取功能中过滤结果。

于 2015-03-27T15:30:05.343 回答