[
{id: 1,
name: "test 1",
children: [
{id: 2,
name: "test 1-sub",
children: []}
]
}]
Imagine a scenario where you have a JSON array structured like the example above, with each element potentially having child elements up to nine levels deep.
If you find yourself exploring this tree structure and need to navigate both up and down the hierarchy, it's straightforward to move down by selecting child elements based on their index. But what about moving back up the tree?
One approach could involve keeping track of two key elements on the page: the main array containing all the data and an indicator showing your current position within the array.
codes: any = [];
currentCode: any = {};
To streamline readability and navigation, consider displaying only one level of the tree at a time - starting with the main code and its immediate child elements below it.
Is there a need to record and map the specific path taken to reach a certain point in the tree, thus allowing you to traverse back up from the top whenever necessary?
I hope this clarification helps avoid any confusion!