【发布时间】:2017-02-10 07:03:42
【问题描述】:
我有关注 Json:
{
"FunctionIs": [{
"id": 1,
"name": "Test",
"Type": "A"
}, {
"id": 2,
"name": "Test2",
"Type": "A"
},{
"id": 3,
"name": "Test3",
"Type": "A"
},{
"id": 4,
"name": "Test4",
"Type": "A"
},{
"id": 5,
"name": "Test5",
"Type": "B"
},{
"id": 6,
"name": "Test6",
"Type": "B"
},{
"id": 7,
"name": "Test7",
"Type": "C"
},{
"id": 8,
"name": "Test8",
"Type": "C"
},]
}
我在我的 html 中通过 ng-repeat 填充这些值:
<tr ng-repeat="businessdata in userObj.businessJson">
<td id="idIs">{{businessdata.id}}</td>
<td>{{businessdata.name}}</td>
</tr>
每当“类型”发生变化(从 A 到 B 和 B 到 C 和 C 到 D 等等),我想插入一个新的 <tr> 仅用于第一次显示标题(类型) .有人可以帮忙吗?
谢谢!
【问题讨论】:
-
你为此做了什么?
-
你在哪里改变类型?
-
Type 来自 JSON,我只需要在 Type 发生变化时触发条件。
-
@RituG.Vijaywargiya 按类型更改您的意思是 string to int
-
不,我的类型是指 Json 中的密钥,因为存在问题
标签: html angularjs json angularjs-ng-repeat