如何为嵌套的 ngFor 离子复选框设置 Ngmodel?

How to set Ngmodel for a nested ngFor ion-checkbox?

我有一个嵌套的 ngFor 复选框。我只需要设置 NgModel 来检查复选框是否被选中?

<ion-item-group *ngFor="let patient of Patients; let i= index">
<ion-item-divider color="light">{{patient.conditionGroup}}</ion-item-divider>
<ion-item *ngFor="let condition of patient.conditions; let j= index">
<ion-label>{{condition}}</ion-label>
<ion-checkbox id="{{condition}}" [(ngModel)]="checkStatus[i][j]" (ionChange)="mylist(i,j,condition)" color="danger"></ion-checkbox>
</ion-item>
</ion-item-group>

我的控制器是这样的..

  {
    this.checkStatus=[];
    this.Patients = [];

    for(var s=0;s<this.Patients.length;s++)
    {this.checkStatus[s]=[];}
    }

How do i check if the checkbox is checked.. error
    ERROR TypeError: Cannot read property '0' of undefined

患者

[
      {
        "conditionGroup": "Family Care",
        "conditions": [
          "Head",
          "Poisoning",
          "Stroke"
        ]
      }
]

在 myList() 中,我需要将选中的选项推送到数组中..

控制器代码

import { Component } from '@angular/core';
import { NavController } from 'ionic-angular';

@Component({
  selector: 'page-home',
  templateUrl: 'home.html'
})
export class HomePage {
  checkStatus = [];
  Patients = [];

  constructor(public navCtrl: NavController) {

    this.initPatients();
  }

  initPatients(){
     this.Patients = [
      {
        "conditionGroup": "Family Care",
        "conditions": [
          "Head",
          "Poisoning",
          "Stroke"
        ]
      },
      {
        "conditionGroup": "Family Care",
        "conditions": [
          "Head",
          "Poisoning",
          "Stroke"
        ]
      },
      {
        "conditionGroup": "Family Care",
        "conditions": [
          "Head",
          "Poisoning",
          "Stroke"
        ]
      }
    ];
     this.updateStatus();
  }
  updateStatus() {
    for (var s = 0; s < this.Patients.length; s++)
    { this.checkStatus[s] = []; }
  }



}

Html

代码
<ion-header>
  <ion-navbar>
    <ion-title>Home</ion-title>
  </ion-navbar>
</ion-header>

<ion-content padding>
 <ion-item-group *ngFor="let patient of Patients; let i= index">
<ion-item-divider color="light">{{patient.conditionGroup}}</ion-item-divider>
<ion-item *ngFor="let condition of patient.conditions; let j= index">
<ion-label>{{condition}}</ion-label>
<ion-checkbox id="{{condition}}" [(ngModel)]="checkStatus[i][j]" (ionChange)="mylist(i,j,condition)" color="danger"></ion-checkbox>
</ion-item>
</ion-item-group>
</ion-content>