I have original
nested object which contains the huge tree kind of structure. This is is basically JSON string which is converted into JavaScript object.
Structure is like -
original = {
type : "table",
children :[
{
type : "cell",
children : [
{
type : "label",
children : []
}
]
}
{
type : "cell",
children : []
}
]
}
I have selected item as -
var select = original.children[1].children[0];
What I want is get the parent
of selected
item.
Here is sample demo - https://stackblitz.com/edit/angular-v5m9ua
Note : I need to trace over the original object to find the parent. I had looked at the other answers but they had mentioned how to design the object structure to get the parent but I don't want to change the original object.