javascript - AngularJS $http and how to get error response -
i see following example calling server-side resource:
usersession.prototype.$save = function() { return $http.post('/users/sign_in', { "user" : { "email" : this.email, "password" : this.password, "remember_me" : this.remember_me ? 1 : 0 } }); };
my question is, possible see actual error response in code in event call fails? how above written that?
you missed callbacks
usersession.prototype.$save = function() { return $http.post('/users/sign_in', { "user" : { "email" : this.email, "password" : this.password, "remember_me" : this.remember_me ? 1 : 0 } }) .success(function (data, status, headers, config) { // success logic here }) .error(function (data, status, headers, config) { // error logic here }); };
Comments
Post a Comment