mercredi 3 février 2016

Ember - How to pass selected option value as parameter to action handler

I am new to ember. Can anyone help me how to pass selected value as parameter to action handler 'onSelectEntityType'. I have tried the following and I am able to trigger the action.

<select class="form-control" id="entityType" {{action 'onSelectEntityType' on='change'}} >
    <option value="">Select</option>
    {{#each model as |entityType|}}
    <option value="{{entityType.id}}">{{entityType.entityTypeName}}</option>
    {{/each}}
</select>

Component js file

import Ember from 'ember';

export default Ember.Component.extend({
    actions: {
      onSelectEntityType(value) {
         console.log(value)
      }
    }
});




Aucun commentaire:

Enregistrer un commentaire