Js listens for changes in input values, judges with radio logic, and requests splicing parameters from the background.

<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

clipboard.png
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!

Oct.22,2021

there is no need to listen to the input is worth changing. Just judge it directly according to whether statusList is selected or not.


org/apply?status=0&status=2 your structure is not good. Generally, queries that determine the number of such parameters (status) can be identified by some appropriate coding system (flag). For example, according to the binary bit, 'machine review' means 1 'machine examination failure' is 2. You can use a 2-bit binary variable status to represent their combinations. For example, status=1, means to query only 'machine review', status=2 means to query only 'machine review failure', and status=3 means query 'machine review failure' and 'machine review failure'

Menu