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.
I need to access the route object so I can redirect the user.
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: {
var user = "user";
var password = "password";
var email = "email";
this.get('user_service').logInUser(email, password, this.handleResponse, this.handleError);
},
handleResponse: function(request) {
console.log(this);
},
handleError: function(error) {
console.log(error);
}
});