我想发送我的 server.js
(在 AngularJS Controller 中)并像这样设置 id
参数:
$http
.get('/getCst', {
params: {
id: customerID
}
})
.success(function (data,status) {
$scope.customer = data
});
但我不确定这是否是正确的方式以及在 Node.js server.js
中应该写些什么:
app.get('/getCst', function (req, res) {
console.log(//how do i get the id sent by the client?);
});
最佳答案
这是我的解决方案
app.get('/getCst/:id', function (req, res, next) {
var id = req.params.id;
});
关于angularjs - 访问 GET 参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27918577/