0

I am trying to create a tree control to use in AngularJS. In an attempt to do this, I'm basing my implementation on this JSFiddle.

This example uses a single 'Parent' element. How could I modify this example such that I could have multiple parents? I need to have a structure like this:

Parent 1
  Child A
    GC I
    GC II
  Child B
Parent 2
  Child C
    GC III
  Child D
    GC IV
    GC V
    GV VI
Parent 3
   Child E
   Child F

For the life of me, I can't figure out how to get multiple parent objects to work. Thank you!

1 Answer 1

1

I updated your fiddle to allow a tree to be an array!

http://jsfiddle.net/n8dPm/189/

<tree families="treeFamily"></tree>

and

 '<div ng-repeat="family in families">'+
            '<p>{{ family.name }}</p>'+
            '<ul>' + 
                '<li>'+
                   '<tree families="family.children"></tree>' +
                '</li>'+
            '</ul>'+
            '</div>',
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.