So I have a Rails API and an Ember application. At the moment, my Ember has a login.hbs
template and a login.js
controller.
I have done a ember install ember-ajax
(http://ift.tt/1TtpFhY).
On entering an email and password, I click on the login button which calls my login.js action loginClicked()
I have the following in my login controller:
// login.js controller
import Ember from 'ember';
export default Ember.Controller.extend({
email: '',
password: '',
actions: {
loginClicked() {
// alert("email: " + this.get('email') + "\npassword: " + this.get('password'));
let params = {
email: this.get('email'),
password: this.get('password')
};
post('/authenticate', {
params: params
});
}
}
});
In my login.js
route handler, I have injected the ember-ajax service:
// login.js route handler
import Ember from 'ember';
export default Ember.Route.extend({
ajax: Ember.inject.service()
});
The problem is, my Mac terminal console is outputting an error saying:
controllers/login.js: line 16, col 7, 'post' is not defined.
I have also tried injecting the ember-ajax service into my controller but it made no difference.
Am I doing something wrong ?
Aucun commentaire:
Enregistrer un commentaire