@tuxman wrote:
Default values using ion-select multiple.
HTML:
<ion-select multiple="true" [(ngModel)]="repeated" (ionCancel)="repeatOnCancel()" (ionChange)="repeatOnChange()"> <ion-option value="mon">Monday</ion-option> <ion-option value="tue">Tuesday</ion-option> <ion-option value="wed">Wednesday</ion-option> <ion-option value="thu">Thursday</ion-option> <ion-option value="fri">Friday</ion-option> <ion-option value="sat">Saturday</ion-option> <ion-option value="sun">Sunday</ion-option> </ion-select>
typescript:
repeated:Array<string> = []; if(this.alarm.mon === true) { this.repeated.push("mon"); } if(this.alarm.tue === true) { this.repeated.push("tue"); } if(this.alarm.wed === true) { this.repeated.push("wed"); } if(this.alarm.thu === true) { this.repeated.push("thu"); } if(this.alarm.fri === true) { this.repeated.push("fri"); } if(this.alarm.sat === true) { this.repeated.push("sat"); } if(this.alarm.sun === true) { this.repeated.push("sun"); }
With the above code the select shows nothing also when clicked on nothing is ticked.
<ion-select multiple="true" [(ngModel)]="repeated" (ionCancel)="repeatOnCancel()" (ionChange)="repeatOnChange()"> <ion-option value="mon" [selected]="alarm.mon">Monday</ion-option> <ion-option value="tue" [selected]="alarm.tue">Tuesday</ion-option> <ion-option value="wed" [selected]="alarm.wed">Wednesday</ion-option> <ion-option value="thu" [selected]="alarm.thu">Thursday</ion-option> <ion-option value="fri" [selected]="alarm.fri">Friday</ion-option> <ion-option value="sat" [selected]="alarm.sat">Saturday</ion-option> <ion-option value="sun" [selected]="alarm.sun">Sunday</ion-option> </ion-select>
With this HTML nothing is shown in the select however the tick boxes are ticked however after I cancel they are removed.
Posts: 1
Participants: 1