Ion-select: dynamically change function in ionChange event


#1

Hi Good Day, Is there a way to dynamically change function in ionChange event?
I tried this:
<ion-select (ionChange)=“test.event” // No error but did’nt work
<ion-select (ionChange)="{{test.event}}" // Shows error
<ion-select [(ionChange)]=“test.event” // Shows error
<ion-select {{ test.event }} // Shows error
<ion-select test.event // Shows error

Thanks.


#2

What I would do is put the conditional logic inside the event handler, instead of in the template. That way the template always sees a single entry point and you don’t have to worry about this.


#3

Thank you.I will do it.


#4

HTML
<ion-select formControlName=“vgroup” (ionChange)=“onSelectChange($event)”>

.ts file
onSelectChange(selectedValue: any)
{
alert(selectedValue);
}