I have an HTML template to display according to a config the return of a JSON configuration
JSON config :
[
{
label: 'Type of contact',
children: [
{
label: 'Type of prospect',
children: [
{
label: 'Seller'
},
{
label: 'Buyer'
}
]
}
]
}
]
To display it I did :
<div ng-repeat="item in $ctrl.filtersConfig">
<span>{{ item.label }}</span>
<div ng-repeat="itemChildren in item.children">
<ul>{{ itemChildren.label }}
<div ng-repeat="itemChildrenOfChildren in itemChildren.children">
<li>{{ itemChildrenOfChildren.label }}</li>
</div>
</ul>
</div>
it works but the problem is that I can have several levels of depth with children
, if I ever have 10 depth levels withchildren
I will have to do 10 ng-repeat
Do you have ideas of how to handle this with more dynamic ways ?