0
我定義了一個$資源,並添加補丁方法:
myapp.factory('Monitoring', function($resource) {
return $resource('/webapp/network/v1/cronjobs/:id/:action', { id: '@id' }, {
status: { method: 'PATCH', params:{id:"@id", action: 'status'}}
}
);
});
當調用URL我得到PATCH http://localhost:8080/webapp/network/v1/cronjobs/1/status 415 (Unsupported Media Type)
changeStatus: function(id, status) {
var m = new Monitoring({id:id});
m.status = status;
m.$status();
}
我的後臺是春天
@RequestMapping(value = "/{id}/status", method = RequestMethod.PATCH)
public ResponseEntity<Void> patchStatus(@PathVariable("id") Long id,
@RequestBody String status) {
}