Home > other >  PrimeNg/Treeselect - How to select node programmatically
PrimeNg/Treeselect - How to select node programmatically

Time:01-04

`

<p-treeSelect
          selectionMode="checkbox"
          [options]="nodes"
          (onNodeSelect)="onSelectedChange($event)"
          placeholder="Select"
></p-treeSelect>

`

The checkbox should be selected already, how to achieve this using p-treeselect ?

CodePudding user response:

You can use [(ngModel)] to bind your data and then its automatically selected.

Customised with official tree example:

https://stackblitz.com/edit/primeng-treeselect-demo-fayhbl

  • Related