<input type="checkbox" (change) = "handleSelectTaskItem($event, taskItem)"
[checked]="taskItem.isCompleted" class="custom-control-input" />
public handleSelectTaskItem(event, taskItem:any) {
const currentIndex = this.full.task.findIndex((task) => task.id === taskItem.id);
for (let i = 0; i < currentIndex; i++) {
const previousTask = this.full.task[i];
if (!previousTask.isCompleted) {
event.currentTarget.checked = false
return;
}
}
if(taskItem.isCompleted === false)
{
taskItem.isCompleted = true
event.currentTarget.checked = true
return
}
else
{
taskItem.isCompleted = false
event.currentTarget.checked = false
}
}