I am in the process of developing a new feature for my Ionic app that involves creating profile groups. Users are required to select profiles from a checkbox list, then click a button to create the group. Once created, the selected profiles should either disappear or become unclickable. However, I am encountering difficulties implementing this functionality. Code: HTML
<ion-list>
<ion-item *ngFor="let profile of profiles; let i = index">
<ion-label>{{profile.name}}</ion-label>
<ion-checkbox color="dark" [(ngModel)]="values[i]"></ion-checkbox>
</ion-item>
</ion-list>
<button ion-button full (click)="addGroup()">Add group</button>
TS
profiles = [];
values = [];
groupList = [];
addGroup(){
let y=0;
for(let i=0; i<this.values.length; i++){
if(this.values[i] == true){
this.groupList[y] = this.profiles[i];
y++;
}
}
let alert = this.alertCtrl.create({
title: 'Group created!',
buttons: ['OK']
});
alert.present();
//I attempted to resolve the issue with the following code snippet...
for(let i=0; i<this.values.length; i++){
if(this.values[i] == true){
this.profiles[i] = 0;
}
}
}