jeudi 31 janvier 2019

EmberJS Select onChange event not passing selected value

I'm trying to get the selected value from a select tag, I have tried these cases but I'm not able to get the selected value, Does anyone have an idea on what is wrong with the way I'm declaring the action on the select tag?

Case 1

In this case I got an error:

Uncaught TypeError: Cannot read property 'apply' of undefined

Template:

 
   <select class="form-control" onchange=>
     <option value="">Select an option</option>
     <option value="1000">$1000</option>
     <option value="100">$100</option>
     <option value="10">$10</option> 
   </select>


Route Actions:

actions: {

   ChangeCombo(paramOne, paramTwo, paramThree) {

     console.info(paramOne, paramTwo, paramThree);

   },

}

Case 2

In this case the first parameter is the current Item from de model array, the second one is the string "Price" but the third parameter is undefined and the last parameter which is supposed to be the event object is also undefined.

Console output:

{object}, "Price", undefined, undefined

Template:


   <select class="form-control" >
       <option value="">Select an option</option>
       <option value="1000">$1000</option>
       <option value="100">$100</option>
       <option value="10">$10</option> 
   </select>


Route Actions:

actions: {

   ChangeCombo(paramOne, paramTwo, paramThree, paramFour) {

     console.info(paramOne, paramTwo, paramThree, paramFour);

   },

}

Ember version

ember-cli: 3.7.1 node: 10.1.0 os: win32 x64




Aucun commentaire:

Enregistrer un commentaire