I need to save current expanded nodes of mat tree close all and then expand them all again. My approach was like this:
Save the expansion model
treeControl = new NestedTreeControl<NavbarNode>((node: NavbarNode) => return node.children);
this.prevExpansionModel = this.treeControl.expansionModel.selected;
this.treeControl.collapseAll();
and then apply it
this.prevExpansionModel.forEach(object => this.treeControl.expand(object));
It works when I do it this way but the nodes that got expanded will no longer work and I can't toggle them. (I cannot toggle those that have been expanded, other ones I can expand and work normally)