Question I got a large nested array with several layer of nested children. The object I get back from API is flat, based on ParentId I can know the parent.
In my HTML I want to loop through every object and show it children.
Does any one have a freaky way to write createSelector and a way to select a state at every loop stage in the HTML, so that why I update a nested child, it does not re-render the whole HTML, but only re-render the object that was updated.
I've looked at Angular material table way of doing, trying to see if anyone else has a concept or a way of doing this.
App information:
- Framework: Angular 5 universal
- Statment mgmt: Ngrx
- Backend: Node + swagger
My API call returns a large array with type of object:
{
"id": "299999999"
"parentId": "5ad4d",
"body": "string",
"type": "test"
}
Every object has a parentID, that lets know what child is below what child object.
I am storing everything in the list in my state. As you see the list has 3 nested children, but I may have nested children around 20 levels deep.
interface AppState {
list: [
{
"id": "299999999"
"parentId": "5ad4d",
"body": "string",
"type": "test"
}
{
"id": "2abc"
"parentId": "299999999",
"body": "string",
"type": "test"
}
{
"id": "2abcd"
"parentId": "299999999",
"body": "string",
"type": "test"
}
{
"id": "2abcde"
"parentId": "299999999",
"body": "string",
"type": "test"
}
{
"id": "2abcde"
"parentId": "6dda4",
"body": "string",
"type": "test"
}
{
"id": "2abcdefg"
"parentId": "2abcde",
"body": "string",
"type": "test"
}
{
"id": "23sadasd"
"parentId": "2abcde",
"body": "string",
"type": "test"
}
{
"id": "12asdasd"
"parentId": "2abcde",
"body": "string",
"type": "test"
}
];
}