Send Request Body on $resource

后端 未结 2 1755
名媛妹妹
名媛妹妹 2020-12-13 17:57

I take a look on Angular API for $resource and I didn\'t find some way to send a Request Body to a RESTful service.

I know this is possible using $http

2条回答
  •  攒了一身酷
    2020-12-13 18:45

    As long as the action supports a body message (e.g. POST, but not GET), you can pass a data parameter to the action method of your resource, which will be sent in the body of the request:

    yourResource.save(yourData)
    

    Example: http://jsfiddle.net/N3NXK/1/

提交回复
热议问题