现在我的情况是,我有一个来自Angular模块的发布请求,试图将一些数据发送到使用node.js和Express处理的URL。从角度发布请求中检索数据
tickets.js:
$http(
{
method: "post",
url: "/ticketDetail",
headers: {"application/json"},
data: {detail : "test"}
}).then(function successCallback(response)
{
$scope.detail = response.data;
}, function errorCallback(response){});
app.js:
app.post("/ticketDetail", function(req, res)
{
console.log(req.data.detail);
res.json(req.data);
}
看起来req.data
是不确定的。
我该如何在我的URL处理程序中从我的请求中检索数据?
显示您的app.js的响应FIEL –
您好,u能表明,如果你分享你的app.js代码的server.js文件 –
,我可以帮助你 –