I need to do some stuff when the same option from the ion-select
menu is selected. However, I can’t find a way to make it work.
There is no way to watch for value changes since there are no changes to the value and if I add @click
to the option it doesn’t do anything.
Is there any way to detect when an option is being selected even if it is the same option?
No, I’m not seeing any way to do that. There’s onCancel, but nothing for onOkNoChange. Even onBlur doesn’t fire every time you close the select (and even tab away). You can try a feature request for an onDismiss or onClose event. Or write some type of wrapper hack for it?
I am trying to understand the use case better… how does one select the same item? can you be more specific?
I have a list of predefined filters with one that is called “Custom”. When you click custom, you get another pop-up to customize filter manually.
That’s why I need it to work every time even if it’s already selected.
You could switch to <ion-checkbox>
, style it like the <ion-select>
so you will have access to the checked
property on ionChange
I found out that ion-action-sheet
component was the best solution for that. You can actually make it work as a select component out of the box with the difference that you can run specific actions after selecting an option.
Thanks for all the ideas though.