I have an ajax request that I pass a callback function to. When the ajax succeeds it successfully triggers the callback. But when I enter the function (which is nested in the route) and try to call this
it errors saying that this
is undefined.
Here's what the route looks like:
export default Ember.Route.extend(UnauthenticatedRouteMixin, {
session: Ember.inject.service('session'),
user_service: Ember.inject.service('user'),
actions: {
this.get('user_service').logInUser(email, password, handleResponse, handleError);
this.get('session').authenticate('authenticator:oauth2', email, password).catch((reason) => {
console.log(reason.error || reason);
});
},
handleResponse: function(request) {
console.log(this);
},
handleError: function(error) {
console.log(error);
}
},
});
Aucun commentaire:
Enregistrer un commentaire