我将在循环中管理离子无线电,在该循环中,我们必须单击单个无线电,选择所有无线电而不是单个无线电。我想选择单个无线电。我尝试了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
})
}