Jon Abrams Jon Abrams - 1 year ago 78
AngularJS Question

Is it possible to make a Tree View with Angular?

I'm looking to display data in a tree structure in a web app. I was hoping to use Angular for this task.

Looks like ng-repeat will allow me to iterate through a list of nodes, but how can I then do nesting when a given node's depth increases?

I tried the following code, but the auto-escaping of the HTML is preventing this from working. Plus, the end ul tag is in the wrong place.

I'm pretty sure that I'm going about this problem entirely the wrong way.

Any ideas?

Answer Source

Have a look at this fiddle

This should give you a good idea of how to display a tree like structure using angular. It is kind of using recursion in html!

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download