how to add functionallity for selectAll option in ion-select? .Please Explain.
Further explain your question
Filter by
select All
A
C
D
E
when i select the option select all it should select all the option A,C,D,E.
simple use this
<div class="card item-icon-right" *ngFor="let item of items" >
<ion-checkbox *ngIf="showCheckBoxes && selectedAll" [(ngModel)]="item.id" mode="ios" [checked]="selectedAll"></ion-checkbox>
<ion-checkbox *ngIf="showCheckBoxes && !selectedAll" [(ngModel)]="item.id" mode="ios" ></ion-checkbox>
</div>
selected values your console log
checkAll(){
this.selectedAll=true;
console.log(this.items);
}
can you explain it more clearly like hows the item list is defined in ts file.
and also i want popup
<ion-select multiple="true" mode="md" [(ngModel)]="name." placeholder="Select One">
<ion-select-option (click)="abc()">select All</ion-select-option>
<ion-select-option>A</ion-select-option>
<ion-select-option>C</ion-select-option>
<ion-select-option>D</ion-select-option>
<ion-select-option>E</ion-select-option>
</ion-select>
this is the code which i am using
copy and paste your html file
<ion-item>
<ion-label>Choose</ion-label>
<ion-select [(ngModel)]="select" multiple="true">
<ion-select-option>select options</ion-select-option>
<ion-select-option>Sandeep Johnson</ion-select-option>
<ion-select-option>India</ion-select-option>
<ion-select-option>Ap</ion-select-option>
<ion-select-option>chennai</ion-select-option>
<ion-select-option>Hyderabad</ion-select-option>
</ion-select>
</ion-item>
<button (click)="read();">select all</button>
your ts file…
private select;
read(){
this.select = [“select options”, “Sandeep Johnson”, “India”, “Ap”, “chennai”, “Hyderabad”];
console.log(this.select);
}
thank you. but my question is i dont want to use selectAll as button i want it as a option only ,when i select that checkbox it should auto select all the other options