I have a collection of Person and in their object, I have a list of familymembers. Each family member is of type Person and they can also have their own list of familymembers. Here is a simplified object description in c#
public class Person
{
public string name {get;set;}
public List<Person> familymembers {get;set;}
}
A example Json data would be:
[
{
"name": "Poppy",
"familymembers": [null]
},
{
"name": "John",
"familymembers": [
{
"name": "Stephanie",
"familymembers": [..]
},
{
"name": "Tom",
"familymembers": [..]
},
{
"name": "Turner",
"familymembers": [..]
}
]
}
]
Poppy doesn't have a collection of familymembers, but John does have. The dots represent another collection of familymembers of type Person.
With angular I would use ng-repeat-start to loop through collection of persons and I would use ng-repeat-end to iterate if I would find that the Person would contain a collection of family members:
The problem:
I really don't know what the depth of the collection would end with x many times. So instead of parse the data to HTML with ng-repeat I would like to use angular template or angular directive to loop x many times whether there would exist a collection of family members in every outer loop.
P.s. This is not a school project, this is just a very simplified version of my problem of knowing when I should iterate the sub-collection if it exist.
Can somebody point me out how they would implement this problem with rendering this kind of data?
Sincerly aghaux