Hello,
I’m quite a newbie in Ember, I first learn Vue.js and I friend told me to try Ember so I just try to do some things around Ember and I am stuck with a newbie problem.
I just generate a component A, for my login form and I don’t understand how to access the model of the template and pass is in an action for example.
I don’t figure how to attach my inputs to my model of my template. Here is my template and controllers.
import Ember from 'ember';
export default Ember.Component.extend({
model : function() {
return {
email : '',
password : ''
}
},
session: Ember.inject.service(),
beforeModel: function() {
return this.get('session').fetch().catch(function() {});
},
actions : {
signIn: function(email, password) {
var datas = {
provider : 'password',
email : 'test',
password : 'testest'
};
this.get('session').open('firebase', datas).then(function(data) {
console.log(data);
});
}
}
});
<div class="centered">
<div class="logoLogin">
<img src="img/logo3.png" alt="">
</div>
<div class="row">
<div class="col-md-12">
<div class="grid simple">
<div class="grid-title no-border">
</div>
<div class="grid-body no-border">
<div class="row">
<div class="col-md-12">
<div class="input-group transparent">
<span class="input-group-addon">
<i class="fa fa-user"></i>
</span>
<input type='text' value={{email}} class='form-control' placeholder="Adresse mail">
</div>
<br>
<div class="input-group transparent">
<span class="input-group-addon">
<i class="fa fa-key"></i>
</span>
<input type="password" value={{password}} class="form-control" placeholder="Mot de passe">
</div>
<br>
<div class="checkbox check-primary right">
<input id="checkbox3" type="checkbox" value="1">
<label for="checkbox3">Se souvenir de moi</label>
</div>
<button {{action "signIn" email password}} type="button" class="btn btn-block btn-primary btn-cons">Se connecter</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
If someone can explain to me how to do this …
Thank you <3