[Fixed] Ionic 2: How to call a method when select value is changed


I am new to Ionic 2, I read the Ionic 2 Documentation over and thought this code would work.
Its supposed to give back the current select value when it’s changed and print it to console.


<ion-select #C ionChange="onChange(C.value)"> 
                    <ion-option value="a">A</ion-option>
                    <ion-option value="b">B</ion-option>


public CValue:String;
onChange(CValue) {

However the console isn’t giving out anything related to this. Did I miss something in the binding?


Instead of

<ion-select #C ionChange="onChange(C.value)"> 

Since ionChange is an event (and not a simple attribute) you need to do it like this:

<ion-select #C (ionChange)="onChange(C.value)">

Leave a Reply

(*) Required, Your email will not be published