mercredi 17 octobre 2018

Select statement using handlebars in Ember

/ exams / template.hbs

<form>
  <select name="selectvalue" id="selectvalue">
     <option value="one"> One </option>
     <option value="two"> Two </option>
     <option value="three"> Three </option>
  </select>
  <button type="submit" > Submit </button>
</form>

/ exams / controller.hbs

import Controller from '@ember/controller';
export default Controller.extend({
    actions: {
        printans: function(){
            let val = this.get('selectvalue');
            console.log(val);
        }
    }
});

All I need is I want to replace the html code in the template.hbs with handlebars, and when the form is submitted, I need to pass the value to the controller.

Thank you




Aucun commentaire:

Enregistrer un commentaire