我有这种一级树情况:
<select ng-model="tipost"
ng-options="tip.DESC group by tip.TIPIS for tip in tipall"><br>
</select>
json在哪里:
[
{"ID":"1", "IDPARENT":"0", "TIPIS":"", "DESC":"GroupName1"},
{"ID":"2", "IDPARENT":"1", "TIPIS":"GroupName1", "DESC":"CHILDNAME1"},
{"ID":"3", "IDPARENT":"0", "TIPIS":"", "DESC":"GroupName2"}
]
问题是这会创建带有孩子的 optgroup,但也会重复根源:
- GroupName1
- GroupName2
[ GroupName1 ]
- CHILDNAME1
[ GroupName2 ]
我想制作:
[ GroupName1 ]
- CHILDNAME1
[ GroupName2 ]