mercredi 6 avril 2016

how emberjs get form values in a object?

templates/module.hbs

<form class="" method="post" {{ action "step1" on="submit"}}>
{{input type="email" value=email}}
{{input type="checkbox" checked=permission}}
{{input type="submit" value="next"}}
</form>

how can i reach email and checkbox value in a object (like model.email and model checkbox ) in Route

routes/module.js

export default Ember.Route.extend({
model() {
    return this.store.createRecord('wizard');
},
actions: {
  step1(){
     alert(this.controller.get('model.email')); // returns undefined
     // get form values like model.email model.checkbox
  },
}

models/wizard.js

export default DS.Model.extend({
  email: DS.attr('string'),
  permission: DS.attr('boolean')
});

Update: [[ alerts returns undefined ]]




Aucun commentaire:

Enregistrer un commentaire