Reputation: 3384
I'm a newbie with Emberjs and I need some advices.
I try to use this addon https://github.com/indexiatech/ember-forms
So I have created my form :
{{#em-form model=sessions submit_button=false}}
{{em-input property="email" type=email label="Email" placeholder="Entrer votre email..."}}
{{em-input property="password" type="password" label="Mot de passe" placeholder="Enter votre password..."}}
<div class="form-actions">
<input {{bind-attr disabled=isntValid}} type="submit" class="btn btn-primary" value="Se connecter">
</div>
{{/em-form}}
so I have a controller to catch the submit action :
export default Ember.Controller.extend({
actions: {
submit: function(){
alert(this.get('sessions.email'));
}
}
});
My question is just I don't get it to how print my value from my form? I try this.get('email')
or this.get('sessions.email')
but always got an undefined
in my alert box
Any help would be great! Thanks!
Upvotes: 1
Views: 177
Reputation: 1074
You need to send an action from the form
{{#em-form model=sessions submit_button=false action='foo'}}
...
{{/em-form}}
and then catch the action in the controller
actions: {
foo: function() {
console.log(this.get('email'))
}
}
Upvotes: 1