我想在表中的 SN 列上进行搜索。
我的表中有很多信息,我希望能够根据SN
进行搜索,但是当我添加过滤器
时,它甚至没有加载我的表
我是这样做的: 在我的 Controller 中,我的列表已填满:
$scope.List = {};
MyServices.getList()
.success(function (data) {
angular.forEach(data, function (value, index) {
$scope.List[value.SN] = {
Description: value.Description,
SN: value.SN
}
});
})
.error(function (error) {
$scope.status = 'Unable to load customer data: ' + error.message;
});
这是我的 HTML:
<label>Search: <input ng-model="search.SN"></label>
<tr ng-repeat="V in List| filter:search">
<td>{{V.SN}}</td>
<td>{{V.Description}}</td>
</tr>
最佳答案
你必须这样写:
<label>Search: <input ng-model="search.SN"></label>
<tr ng-repeat="V in List| filter: {SN: search.SN}">
<td>{{V.SN}}</td>
<td>{{V.Description}}</td>
</tr>
关于html - 表格中的 Angular 搜索,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38584924/