I want an ion-select with one button saying ‘save’. I also want to use a handler for that button.
This is what my ion-select alert looks like currently:
The ‘cancel’ and ‘ok’ buttons should be replaced by just one ‘save’ button.
I was able to change the title and message of the ion-select alert, but for some reason the buttons won’t change.
In the docs it says this should be possible select - ionic API
Note: this select is a component.
In my .ts file:
this.selectOptions = {
title: this.global.translate.selectPark,
message: this.global.translate.onlyChooseOnce,
buttons: [
{
// Save button
text: this.global.translate.save,
handler: () => {
console.log('Save clicked');
this.storage.set(this.parkKey, this.parkValue).then((value) => {
console.log('storage.set returs: ', value);
this.parkLocationChoose.setParkValue(this.parkValue);
})
}
}
]
}
my html:
<ion-select #parkSelect [selectOptions]="selectOptions">
<ion-option *ngFor="let park of parks" [value]="parkValue">
{{ park }}
</ion-option>
</ion-select>