I have binded the checkbox values dynamically. So now based on check and uncheck, i need to pass the same array of data, with values as true/ false.. But now, even the value is checked it is showing false only and based on check and uncheck values, if i uncheck anyone of the checkbox, the select/Unselect is still checked.
DEMO: DEMO
TS:
checkAll(ev) {
if (!this.all) {
this.PrintList.forEach(x => x.value = true)
this.isAllChecked()
} else {
this.PrintList.forEach(x => x.value = false)
this.isAllChecked()
}
}
isAllChecked() {
this.all = !this.all
}
onChange(event, item) {
if(event){
this.printLists.push(item);
} else {
this.printLists.splice(this.printLists.indexOf(item), 1)
}
}
Aucun commentaire:
Enregistrer un commentaire