答案 0 :(得分:2)
如果您总是希望隐藏第一个结果,那么只需将类放在类型为.hide-first-result
的类型上,然后使用css隐藏它:
.hide-first-result ul > li:first-child { display: none; }
例如:
<span class="hide-first-result">
<input type="text" ng-model="selected" uib-typeahead="state for state in states | filter:$viewValue | limitTo:8" class="form-control">
</span>
答案 1 :(得分:1)
您可以从列表中删除第一个元素:
<input type="text" class="input-fit"
typeahead-on-select="selectItem($item);"
typeahead-min-length="3"
typeahead-wait-ms="1000"
typeahead-loading="loading"
ng-model="selectItem"
data-ng-click="resetItemInput()"
uib-typeahead="i.name for i in items($viewValue)">
然后从成功回调数据中删除第一个:
$scope.items = function(search) {
var defer = $q.defer();
ItemService.getItems(search).then(function(data) {
defer.resolve(data.splice(0,1));
});
return defer.promise;
};