Hi Shreekumar,
Good day to you.
We have validated the reported problem and the code snippets shared. In your code, your formcontrol value remains null even after the checkbox is clicked. Since there is no sync between the tree view’s checkbox and your form Control, you need to manually update the formControl’s status in the nodeChecked event of tree view. Please refer to the following code snippet.
valueSelected(args){
if (args.action == "check") {
this.appComponent.branchPlanForm.controls.channels.patchValue(1);
}
else if (args.action == "uncheck") {
if (this.tree.checkedNodes.length == 0)
this.appComponent.branchPlanForm.controls.channels.patchValue(null);
}
} |
Sample:
Kindly check the above sample and let us know if you need any further assistance.
Regards,
Ashokkumar B.