Angular $resource does not parse correctly an integer response

后端 未结 4 1690
别那么骄傲
别那么骄傲 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:09

    I've actually found this to be an issue with integers, strings, and bools.

    If you are using WebAPI, do something like this:

    public object ControllerMethod()
    {
        
        return new { value =  };
    }
    

    If Node, use CodeLander's answer.

    In your Angular code, you'll just have to get the .value of what's returned.

提交回复
热议问题