Angular UI bootstrap typeahead ng-model在清空文件时显示为null

Angular UI bootstrap typeahead ng-model says null when clear the filed

本文关键字:文件 显示 null 清空 UI bootstrap typeahead ng-model Angular      更新时间:2023-09-26

过滤器工作得很好,但不幸的是,{{filterlist.name}}说null一旦删除键入的文本,并且由于null

表看起来为空

演示:https://plnkr.co/edit/1QVdctw1hr4ggJOtFHUZ?p=preview

<input type="text" class="form-control" placeholder="Name" 
  ng-model="filterlist.name" 
  typeahead-editable="false" 
  uib-typeahead="person.name as person.name for person in expenses | filter:{name:$viewValue} | limitTo:8">

查看此更新的Plunk

我想你漏报了controller中的filterlist

$scope.filterlist = { name: '' };

我把{{}}部分在表的顶部只是为了可读性。我不知道为什么这对你来说是个问题。