In Angular 6, I am utilizing mat-tree
along with mat-nested-tree-node
. My objective is to dynamically load the data when the user toggles the expand icon.
Attempting to apply the dynamic data concept from the Flat Tree
example provided in Material Examples, I have endeavored to implement a similar approach for the Nested Tree
. You can view what I have done so far at https://stackblitz.com/edit/angular-naarcp.
However, despite the console indicating that the data is being updated, only the prepopulated data in the array is displayed on the UI. It consistently calls the _getChildren
method for the initial nodes parent, child1, child2, child3
. Although I add My Child
under child1
and child3
when expanded by the user, the added node does not appear.
The limitation lies in not being able to include dynamic children within the _getChildren
, as it recurs until reaching the last node.
Note:
I prefer not to use the Flat tree due to its management of everything in a single array, making it cumbersome to update asynchronously loaded data.
Seeking Help
Am I overlooking something, or are nested trees inherently designed to function this way?