【发布时间】:2019-08-06 14:36:16
【问题描述】:
我正在尝试预先选择此 mat-tree 示例的复选框:https://stackblitz.com/edit/material-tree-checklist。出于某种原因,我无法在组件初始化时预先选择复选框。
我正在尝试将两个 rxjs observable 与 combineLatest 结合起来。第一个包含 mat-tree 的数据节点。第二个包含应该预选的数据节点。这是我不起作用的解决方案:https://stackblitz.com/edit/material-tree-checklist-rj4ryd?file=app/app.component.ts
Mat-tree 本身正在使用 this.allData$,但在使用 this.selectedData$ 初始化组件时检查选定的复选框不起作用。
combineLatest(this.allData$, this.selectedData$)
.subscribe(val => {
this.dataSource.data = val[0]
val[1].map(x => this.nodeSelectionToggle(x))
}
)
【问题讨论】:
标签: angular rxjs angular-material