0
votes

I used the tree-checklist component in my app. Somebody know how I can get the nodes selected ?

I used this example : https://stackblitz.com/angular/nkmjydodvnp?file=app%2Ftree-checklist-example.ts

I tried to used the method isSelected(node) but it is not relevant.

Thanks !

2
can you add relevant code you have used for your tree-checklist and any attempts you've made to get the nodes selected? The more information you can provide the more likely you will receive helpful responses. - mlapaglia

2 Answers

0
votes

component.ts

checkUncheckAll() {
  this.nestedNodeMap.forEach((val: TodoItemFlatNode) => {
    if (!val.level) {
      this.todoItemSelectionToggle(val);
    }
  });
}

template.html

<button mat-raised-button color="primary" (click)="checkUncheckAll()">Check/Uncheck</button>
0
votes

To check all by default i did this ,call this function inside constructor

selectAllIntial() {
  for (let node in this.dataSource.data) {
      this.todoItemSelectionToggle(this.transformer(this.dataSource.data[node], 0))
 }
}