我想顯示行和它們的列值的總和。它有三個州在哪個條件下舉行。吳 - 顯示條件的記錄
1)自動 2)生活 3)autolive(未在本JSON,需要汽車和住行結合)
結論:
在siteData.jobType == toggleValue如果(toggleValue = =汽車),它顯示 「自動」
在siteData.jobType == toggleValue(toggleValue ==活)的記錄,它表明 「活」 的記錄
但在siteData.jobType == toggleValue(toggleValue ==自動) ,它顯示沒有記錄,怎麼autolive不存在於JSON
我如何能實現它顯示相結合的自動記錄和生活?
//定製切換按鈕https://github.com/tannerlinsley/nz-toggle
<nz-toggle
tri-toggle
on-toggle="myFunction()"
ng-model="toggleValue"
val-true="'auto'"
val-false="'live'"
val-null="'autolive'">
</nz-toggle>
<table class="table table-condensed" border ="1" >
<thead>
<tr>
<th>PiteId</th>
<th>PiteId</th>
<th>Type</th>
<th>Date</th>
<th >Success</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="siteData in siteObject" ng-show="siteData.jobType==toggleValue" >
<td>{{siteData.sid}}</td>
<td>{{siteData.PiteId}}</td>
<td>{{siteData.Type}}</td>
<td>{{siteData.Date}}</td>
<td ng-init="siteObject.total.siteData.countSuccess = siteObject.total.siteData.countSuccess + siteData.countSuccess">{{siteData.countSuccess}}</td>
</tr>
</table>
JSON格式
siteObject =
{
"data": [
{
"sid": 1,
"PiteId": "1~10-4-2017~15:13:40",
"Type": "live",
"Date": "2017-04-14T18:30:00.000Z",
"countSuccess": 1
},
{
"sid": 1,
"PiteId": "1~10-4-2017~15:13:40",
"Type": "auto",
"Date": "2017-04-14T18:30:00.000Z",
"countSuccess": 1
}
]
}
我希望所有的人,當我切換autolive
你試圖尋找在[角度濾波器(https://docs.angularjs.org/api/ng/filter/filter),而不是你的表'NG-show'? – Theo
@Theo 看到我是新的角度,如果它適用,那麼我不知道如何? – Creator
你想要的是當自動切換開啓時,顯示所有數據? (數據類型自動和類型生活)? – Theo