【发布时间】:2019-08-30 14:10:34
【问题描述】:
我已经看到了各种使用扩展 mat-tree 中所有节点的示例
expandAll()
如果我们单击某个特定节点,是否有任何机制可以展开它。类似的东西
node.expand()
我参考了 angular material 文档,但没有得到任何答案。如果有人经历过,请指导。
【问题讨论】:
标签: angular tree angular-material2 expand
我已经看到了各种使用扩展 mat-tree 中所有节点的示例
expandAll()
如果我们单击某个特定节点,是否有任何机制可以展开它。类似的东西
node.expand()
我参考了 angular material 文档,但没有得到任何答案。如果有人经历过,请指导。
【问题讨论】:
标签: angular tree angular-material2 expand
您要查找的是treeControl 上的expand 方法,该方法对treeControl.dataNodes 数组进行操作。
类似
this.treeControl.expand(this.treeControl.dataNodes[/** node you want to expand **/]);
请记住,如果您要扩展特定节点,则它的所有祖先(直到根)也需要扩展。
【讨论】: