-6

I am new to Angular2, so if i ask something stupid, just help me out with it!

I want to create a dynamic tree view using Angular2. So can you just help me out with this !.

Siju Samson
  • 437
  • 2
  • 6
  • 16

2 Answers2

1

You need create a component that replies itself. So first thinking in data. You generally has an array of objects. This objects will have almost two properties "item" and "children". "children" can be null or an object of the same type. ok?

 item1
   item1-1
      item2-1,
      item2-2
   item1-2
 item2
 item3
    item3-1
    item3-2
       item3-2-1

How you want to create?

To display them, you can use a component that replies itselft like angular 5 display nested questions and answer show item under it parent item

Eliseo
  • 50,109
  • 4
  • 29
  • 67
0

Maybe you could use a third party library to accomplish what you want? It displays/interacts with a dynamic tree structure like you want https://github.com/artbelikov/angular2-tree-diagram

rhavelka
  • 2,283
  • 3
  • 22
  • 36