AngularJS service not invoking error callback on save() method

前端 未结 6 2108
伪装坚强ぢ
伪装坚强ぢ 2021-01-17 18:07

So I\'m using angularjs restful service $resource and I\'m calling $save function. However, the error callback I pass to it is not being called. The server is sending a 41

6条回答
  •  一生所求
    2021-01-17 18:36

    I found the following in the ngResource source code

    $http({method: 'GET', url: '/someUrl'}).
        success(function(data, status, headers, config) {
            // this callback will be called asynchronously
            // when the response is available
        }).
        error(function(data, status, headers, config) {
            // called asynchronously if an error occurs
            // or server returns response with status
            // code outside of the <200, 400) range
        });
    

    I am kind of confused about the range notation but it seems it should actually call the error method. Maybe you found a bug.

提交回复
热议问题