单击ionic3中的单个离子无线电后,选择所有无线电。

时间:2019-01-20 14:04:59

标签: ionic3 radio-group

我将在循环中管理离子无线电,在该循环中,我们必须单击单个无线电,选择所有无线电而不是单个无线电。我想选择单个无线电。我尝试了Angular JS方法,但是将起作用,但离子无线电值将不确定。我的html和ts代码是?

 <ion-card *ngFor="let item of itemList">
     <ion-list radio-group  [(ngModel)]="chart">
     <ion-label>Present</ion-label>
       <ion-radio [color]="myColor" value="Present" (ionSelect)="toggleColor()">ID</ion-radio>
       <ion-radio [color]="myColor" value="Absent"  (ionSelect)="toggleColor()">Address</ion-radio>
       <ion-radio [color]="myColor" value="Leave"  (ionSelect)="toggleColor()">Name</ion-radio>

  

Below our ts code:
  this.itemList = [{
      name : 'Harry',
      id :  101
    },
    {
      name : 'soni',
      id :  101
    },
    {
      name : 'deep',
      id :  101
    }]
}

toggleColor(item){

  if(this.chart == 'Present') {
      this.myColor = 'secondary';
  }  else if( this.chart == 'Absent') {
    this.myColor = "danger";
   } else {
     this.myColor = "danger";
   }
     this.itemList.every(function(chart) {
       return chart.Selected == true
     })  
  }
我已经尝试过用于管理复选框的每个功能,告诉我这里我错了吗?

0 个答案:

没有答案