Angular UI bootstrap typeahead ng-model 在清除文件时说 null

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

过滤器工作得很好,但不幸的是,{{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">

勾选这个Updated Plunk

我想你错过了在 controller

中声明 filterlist
$scope.filterlist = { name: '' };

为了便于阅读,我将 {{}} 部分放在了 table 的顶部。 不确定为什么这对您来说是个问题。在 Chrome 为我工作