我的清单中有30到40项。用户首先从列表中选择第25个项目,然后单击清除图标,然后再次开始搜索。那时,滚动条位置保持在第25项位置,而不是顶部。我想在用户清除所选项目时将滚动条重置为顶部。有人可以帮我吗?
HTML
<div class="typeahead__wrapper">
<input type="text"
class="form-control typeahead-model"
ng-model="$ctrl.selectedItem"
ng-blur="$ctrl.onBlur()"
placeholder="{{$ctrl.placeholder}}"
ng-disabled="$ctrl.ngDisabled"
typeahead-no-results="$ctrl.noResults"
typeahead-editable="$ctrl.allowCustom"
typeahead-template-url="customTemplate.html"
uib-typeahead="item as item[$ctrl.searchField] for item in $ctrl.itemList | filter:$ctrl.search($viewValue) | limitTo:$ctrl.displayLimit"
typeahead-on-select="$ctrl.itemChanged()"
typeahead-show-hint="true"
typeahead-min-length="0"
>
<div class="form-control-feedback">
<a href="javascript:void(0)" ng-click="$ctrl.reset()" ng-if="$ctrl.selectedItem"
class="typeahead__reset">
<em class="fa fa-times-circle"></em>
</a>
</div>
</div>
JS
reset() {
this.selectedItem = null;
this.itemChanged();
}
我的用户界面就是这样