Angular $resource does not parse correctly an integer response

后端 未结 4 1687
别那么骄傲
别那么骄傲 2020-12-17 00:32

I am using the Angular $resource to make requests to my controllers, implemented on a Spring application. When the controller returns just an Integer value, $resource parse

4条回答
  •  借酒劲吻你
    2020-12-17 01:08

    Maybe try setting the responseType in the action config, like this:

    $resource(url, {}, {
        get: {
            method: 'GET',
            responseType: 'text'
        }
    });
    

    If that doesn't work you probably need to use transformResponse or an $http interceptor to modify the response before the resource gets a hold of it. See $http docs.

提交回复
热议问题