Angular1:无法将参数传递给后端

时间:2018-11-02 21:19:29

标签: java angularjs

我正在使用java-spring MVC框架上的angular1。我有一个后端Java服务

@RequestMapping( value = "/layout/guess/{id}/{maxColumns}/{origin}", method = RequestMethod.POST )
public ResponseEntity<?> guessLayout( @PathVariable( "id" ) long id,
        @PathVariable( "maxColumns" ) int maxColumns,
        @RequestParam( value = "delimeter", required = true)  String delimiter,
        @PathVariable( "luckyOrigin" ) String origin )
{
    try
    {
        //do something with delimiter
     }
 }

现在来自前端javascript控制器/服务,我将上述服务称为(在函数内部):

return $http.post( 'submenu/layout/guess/' + id + '/' + maxColumns  + "/" + origin,
            delimiter)
            .then(
                function( response )
                {
                    return response.data;
                },
                function( errResponse )
                {
                    console.error( 'Error while guessFieldLayout' );
                    return $q.reject( errResponse );
                }
            );

总是出现错误

Required String parameter 'delimeter' is not present

我不能将“定界符”用作URL的一部分。对我做错了什么有了解?

0 个答案:

没有答案