I have an ionic select directive and wanna handle the 'OK' button, that when I click the button it should go and call some function.
I know that we have the (ionChange) but this one is only done when I change a selected element.
Thanks in advance.
You can simply do something like:
html:
<ion-select id="something" name="something" [(ngModel)]="something" (ionChange)="something($event)" data-live-search="true">
<ion-option *ngFor="let s of something" [value]="s.id">{{s.name}}</ion-option>
</ion-select>
<ion-button (click)= "clicked()" >Hit Me!</ion-button>
ts:
clicked(){
//call your function
//use this.lastSelected for your function.
}
something($event) = {
this.lastselected = $event.target.value;
}
(ionChange)=“onChange($event)”should do the trick. It should fire when the ok button is pressed. Do you use ion-options inside of ion-select only? - Sam