I need to get the path from given node to root in a Angular nested Mat-Tree.
Preferably starting from root until I get to my chosen node. Note that the chosen node can be repeated in the multiple leaves of the tree (with the same node name).
The answer might look like a 2D array in which the first dimension is an array of paths and seconds dimension is the array containing the nodes in the path.
I 'm not really comfortable with recursive functions can someone please help me figure this one out?
An example of the tree structure from Angular.io can be found on stackblitz. Just imagine that the fruit or vegetables in this example could be repeated in multiple categories.
EDIT1: Clarification, more context, added example link