I am trying to search trhough an object to check for validation like so
var selLess = $scope.accountTreeHere.map( function(obj){
return obj.selected;
});
So this works fine however, there is actually one level deeper that has items with .selected that i would like to combine into this variable, this map only seems to go on the first level of the accountTreeHEre, when I need it to go down into any level looking for the key of selected. is this possible with underscore? I am new to underscore so I'm still unsure of how to do this.
I basically want to map over the entire object for anything with the key of selected, no matter how deep, and return an array of their values.
Thanks for reading!
So the accountTreeHere would look somehting like this
[{name : name 1, selected: true, subs : [{selected : true, name : sub 1},{selected : false, name : sub 2}]},{name : name 2, selected: false, subs : [{selected : false, name : sub 1},{selected : false, name : sub 2}]}
so it just has nested objects inside sub here for example that also have keys of selected that I want to add into this array.
accountTreeHeremight look like?selected: true?[true, true, false, false, false, false]?