gpt4 book ai didi

html - 表格中的 Angular 搜索

转载 作者:行者123 更新时间:2023-11-27 23:25:55 24 4
gpt4 key购买 nike

我想在表中的 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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com