AngularJS service not invoking error callback on save() method

前端 未结 6 2107
伪装坚强ぢ
伪装坚强ぢ 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条回答
  •  -上瘾入骨i
    2021-01-17 18:53

    I couldn't get Alter's answer to work, but this worked for me:

    user.$save(function (user, headers) {
                        // Success
                        console.log("$save success " + JSON.stringify(user));
                    }, function (error) {
                        // failure
                        console.log("$save failed " + JSON.stringify(error))
                    });
    

提交回复
热议问题