请求方法'删除#39;不支持angularjs弹簧启动

时间:2015-04-17 10:39:14

标签: javascript angularjs spring-boot spring-data-rest

你好,我使用的是spring boot,restful web service和angularjs,

这是我的restControlleur

@RestController
@RequestMapping("/structure")
public class StructureNotificationRestContolleur {

 @Autowired
 StructureNotificationService StructureNotif;
 @Autowired
 ChampService champService;

 @RequestMapping(value = "/deleteChamp/{ch}", method=RequestMethod.DELETE )
    public @ResponseBody void DeleteChamp(@PathVariable (value="ch") int ch) 
    {
     champService.DeleteChamp(ch);
    }

有要删除的按钮:

$scope.deleteST= function(ids)
            {
                 $http.delete('/structure/deleteChamp/'+ids).
                 success(function(data) {
                     alert(ids);

                 });

            }

但有错误: o.s.web.servlet.PageNotFound:请求方法' DELETE'不支持

???

1 个答案:

答案 0 :(得分:0)

$scope.deleteST= function(ids)
        {
             $http.delete('/structure/deleteChamp/', ids).
             success(function(data) {
                 alert(ids);

             });

        }

编辑*** Clarificaction:+参数作为加法意味着你将在操作结果时结束STRING,而#34;," paramether意味着你最终会得到一个字符串url加上你需要的javascript / Json对象。

尝试使用","而不是" +"