<ng-template ngFor [ngForOf]="checklist" let-item let-i="index">
<div class="ui checkbox">
<input type="checkbox" name="status" [checked]="item.isChecked">
<label for="wait-loan-id" class="Settlement">{{item.name}}<span class="black">({{item.cnt}})</span></label>
</div>
</ng-template>
the effect of the page is as follows:
The code for
ts looks like this:
getCheckList(): void {
let statusList: any = [
{ name: "", value: 0, cnt: 0 },
{ name: "", value: 2, cnt: 0 }
];
statusList.map((item) => {
return item.isChecked = true;
});
this.checklist = statusList;
}
chooseStatuses(event, index): void {
let { value, checked } = event.target;
this.toggleItemStatuses(checked, value, index);
}
subscript status
when I send a request, I need to determine whether the check of the status is to select all or single. If I select all, I need
org/apply?status=0&status=2 to request from the backend. If I choose one, I will monitor the change of the input value. But I will not, and the logic of judging the status of the single selection and selecting or canceling the current state is not very clear. Ask for help from the boss!