Skip to content Skip to sidebar Skip to footer

What's The Parameter For Ngresource Save() Method's Callback

I'm refactoring my angular code from using $http to ngResource. I used to have code like this in my service: svc.login = function(username, password) { return $http.po

Solution 1:

I think the issue comes from transformRespose

transformResponse – {function(data, headersGetter)|Array.} – transform function or an array of such functions. The transform function takes the http response body and headers and returns its transformed (typically deserialized) version. By default, transformResponse will contain one function that checks if the response looks like a JSON string and deserializes it using angular.fromJson. To prevent this behavior, set transformResponse to an empty array: transformResponse: []

try transforming your response into a json:

transformResponse: function (data) {
        return { token: angular.fromJson(data) }

Post a Comment for "What's The Parameter For Ngresource Save() Method's Callback"