I have a list of to-dos and each to-do has a checkbox. Initially, the to-do is "Undone". When I check a box, that means the to-do is marked as "Done". When I uncheck it back, that means it is back to being "Undone". I already figured out how to remain the check mark when the to-do is "Done" but when I uncheck it back and refresh the page, that to-do is still checked. Here's my code:
HTML:
<span style="vertical-align: -webkit-baseline-middle;">
<input icheck type="checkbox"
ng-model="check1"
ng-change="vm.markAsDone(toDo.value.instanceId)"
ng-checked="toDo.value.members.status.value='Done'">
<span class="m-l-xs"></span>
</span>
Controller:
function markAsDone(id) {
todolistService.markAsDone(id).then(function (response) {
notifyService.success($translate.instant('MSG_TODO_MARK_AS_DONE_SUCCESS'));
$state.reload();
}, function (error) {
notifyService.showError(error);
});
}
How do I retain the unchecked state of the checkbox after I refresh the page, so the to-do will be back to being "Undone"?
Aucun commentaire:
Enregistrer un commentaire