Angularjs: ng-options with group -
i have 1 level tree situation:
<select ng-model="tipost" ng-options="tip.desc group tip.tipis tip in tipall"><br> </select>
json is:
[ {"id":"1", "idparent":"0", "tipis":"", "desc":"groupname1"}, {"id":"2", "idparent":"1", "tipis":"groupname1", "desc":"childname1"}, {"id":"3", "idparent":"0", "tipis":"", "desc":"groupname2"} ]
problem creates optgroups children repeats roots too:
- groupname1 - groupname2 [ groupname1 ] - childname1 [ groupname2 ]
want produce:
[ groupname1 ] - childname1 [ groupname2 ] thanks in advance.
the grouping doesn't quite work that, if change json this:
[ {"id":"1", "tipis":"groupname1", "desc":"name"}, {"id":"2", "tipis":"groupname1", "desc":"name1"}, {"id":"3", "tipis":"groupname2", "desc":"name2"}, {"id":"4", "tipis":"groupname1", "desc":"name3"}, ] then you'll grouping way want
jsfiddle: http://jsfiddle.net/rtcp3/182/
Comments
Post a Comment