Hi Can,

I couldn't resist playing with it, I might as well share the result 
<http://plnkr.co/edit/hHsH40L3wUYLZ3dl5Y3T?p=preview>with you :)

Has nothing to do with angular whatsoever. Rebuild your sample into a 
recursive function:

    vm.testData = function() {
        vm.actionTest = [];  
        traverse(vm.data);

        function traverse(arr) {
            arr.forEach(checkOut);

            function checkOut(item) {
                vm.actionTest.push(handle(item));
                item.childs && traverse(item.childs); // to lazy to write 
an if ;)
            }
        }

        function handle(source) {
            return {
                ID: source.id,
                Depth: source.depth,
                Actions: source.actions.map(indexForChecked).filter(
isChecked)
            };

            function indexForChecked(action, index) { return action.isChecked 
? index : -1; }
            function isChecked(action) { return action !== -1; }
        }
    };


Does that help you a bit?

Regards
Sander

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to angular+unsubscr...@googlegroups.com.
To post to this group, send email to angular@googlegroups.com.
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to