(click) not working with ion-option and ion-select


i am involking a function when user clicks on one of the option in dropbox(i.e select - option) , but it seems like click is not working in this case to invoke the function clickOption

.html file

            <ion-option (click)="clickOption()"> morning </ion-option>

.ts file

                 console.log("hello you clicked clickOption");

please suggest how to invoke the clickOption function… Thanks in advance


This should be done this way (check out the ion-option docs for details):

            <ion-option (ionSelect)="clickOption()"> morning </ion-option>

However it probably won’t work ATM due to the following issue:

As a workaround you could try using the ionChange event of the ion-select component, i.e. using the following HTML (but note that this isn’t exactly the same, and might not satisfy your requirements, as it’s emitted only upon change of the selected option, while ionSelect should be emitted when an option is clicked as it’s specified in your question):

        <ion-select (ionChange)="clickOption()">
            <ion-option> morning </ion-option>


I’ve found a workaround,
Don’t use a function but a setter instead, to execute the action:

    <ion-option (ionSelect)="clickOption = optionValue"> morning </ion-option>
set clickOption(optionValue: string) {
    \\ do what you want

explained here
example here
hope it will help someone :slight_smile: