【发布时间】:2017-09-26 05:24:30
【问题描述】:
我是 angularjs 的新手,每天都在学习,但不知何故我无法弄清楚如何过滤这些数据以显示在表格中。
部分,失败和成功
我想显示在分隔符'|'之前有 1 的数据
Ex 在 Success 单元格中:1|12311 0|2122 显示结果 12311
<table class="table table-condensed" border ="1" align="center">
<tr>
<th>Job Id</th>
<th>Job Type</th>
<th>Nb of Urls</th>
<th>Size of Page</th>
<th>Bytes</th>
<th>Site Id</th>
<th>Partial</th>
<th>Fail</th>
<th>Success</th>
</tr>
<tr ng-repeat="detailData in detailObject">
<td>
<span ng-bind="detailData.jobId"></span>
</td>
<td>
<span ng-bind="detailData.jobType"></span>
</td>
<td>
<span ng-bind="detailData.Date"></span>
</td>
<td>
<span ng-bind="detailData.countUrl"></span>
</td>
<td>
<span ng-bind="detailData.countBytes"></span>
</td>
<td>
<span ng-bind="detailData.sid"></span>
</td>
<td>
<span ng-bind="detailData.countPartial | filter: scidStatusFilter"></span>
</td>
<td>
<span ng-bind="detailData.countFail"></span>
</td>
<td>
<span ng-bind="detailData.countSuccess"></span>
</td>
</tr>
</table>
// 输入 JSON
{
"statusCode": 200,
"message": "Getting Data",
"data": [
{
"jobId": "2~27-4-2017~10:46:27",
"sid": 1,
"jobType": "mode",
"date": "2017-04-14T18:30:00.000Z",
"countSuccess": "1|12311 0|2122",
"countFail": "0|12311 0|2122",
"countPartial": "1|2122 0|12311",
"countUrl": 24,
"countBytes": 246
},
{
"jobId": "2~27-4-2017~11:2:58",
"sid": 2,
"jobType": "mode",
"date": "2017-04-24T18:30:00.000Z",
"countSuccess": "1|12311 0|2122",
"countFail": "0|12311 0|2122",
"countPartial": "1|2122 0|12311",
"countUrl": 24,
"countBytes": 246
},
{
"jobId": "2~27-4-2017~11:7:57",
"sid": 2,
"jobType": "ondemand",
"date": "2017-04-24T18:30:00.000Z",
"countSuccess": "1|12311 0|2122",
"countFail": "0|12311 0|2122",
"countPartial": "1|2122 0|12311",
"countUrl": 24,
"countBytes": 246
},
{
"jobId": "2~27-4-2017~12:19:16",
"sid": 2,
"jobType": "mode",
"date": "2017-04-24T18:30:00.000Z",
"countSuccess": "1|12311 0|2122",
"countFail": "0|12311 0|2122",
"countPartial": "1|2122 0|12311",
"countUrl": 24,
"countBytes": 246
}
]
}
【问题讨论】:
标签: javascript angularjs json filter html-table