我有这个一级树状况:
<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","DESC":"GroupName2"} ]
问题是这会创建与他们的孩子的optgroups但重复
根源:
- GroupName1 - GroupName2 [ GroupName1 ] - CHILDNAME1 [ GroupName2 ]
我想生产:
[ GroupName1 ] - CHILDNAME1 [ GroupName2 ]
提前致谢.
分组不会像这样工作,如果你将json更改为这样的事情:
[ {"ID":"1","DESC":"name"},"DESC":"name1"},"TIPIS":"GroupName2","DESC":"name2"},{"ID":"4","DESC":"name3"},]
然后你会按照你想要的方式得到分组
jsFiddle:http://jsfiddle.net/rtCP3/182/