In an Angular project I want to display a simple Material Tree. For this I have also imported the {MatTreeModule} from '@angular/material/tree';
in the app.module. Also no errors are displayed and it compiles. However, no tree appears at the desired location. I have tested this in several components. And if the tree is in a component (without being displayed), the whole page gets stuck and no button or the like works anymore. You can click them, but they suddenly have no function. In some components the whole content stays white and nothing is rendered. What am I doing wrong or have I forgotten?
Therefore i used this simple example from angular material page:
<mat-tree>
<mat-tree-node> parent node </mat-tree-node>
<mat-tree-node> -- child node1 </mat-tree-node>
<mat-tree-node> -- child node2 </mat-tree-node>
</mat-tree>
You will need to add dataSource and treeControl for the mat-tree element like this example you can find more examples here click on View code icon to see the code.