过滤器工作得很好,但不幸的是,一旦删除了键入的文本,{{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: '' };
为了便于阅读,我将 {{}}
部分放在表格顶部。
不确定为什么这对您来说是个问题。我可以在 Chrome 中使用
关于javascript - Angular UI 引导 typeahead ngmodel 在清除字段时显示 null,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39665554/