I am having a problem in which I cannot find the answer anywhere on the internet. I am trying to dynamically create a category list in AngularJS where I don´t know on forehand how many levels I need. The values are fetched from a database, with a parentID, and each element may have one or more children.
I have used ng-repeat before to create two-level lists, but I do not know how to add more levels without nesting as many repeats as I need on forehand. I know how to do this in php to generate the data, but that is not what I wish to accomplish.
I might need to use directives or some sort, but I need someone to point me in the right direction.
There is kind of a solution in this plunk: http://plnkr.co/edit/NBDgqKOy2qVMQeykQqTY?p=preview but I think this is a very dirty fix, and I am really searching for a better one.
Thank you for any tips or hints.
Kind regards, Kjetil.