私の角度jsファクトリでは、入力モデル値をサーバー側(ノードjs)に転送するためにajax呼び出しを行っていますが、取得しようとすると 'undefined' 。ノードjsの要求パラメータを取得できません
角度JS:私は以下有するノードJSで
angular.module('name-App').factory('myService', function($http,$rootScope) {
return {
getFoos: function(stock) {
console.log("----------->"+stock.toString());//displays the value correctly over here .
//return the promise directly.
return $http({
url:'http://localhost:3000/gethistorydata',
method: "GET",
params: stock
}).then(function(result) {
alert("result.data"+result.data);
return result.data;
}).catch(function(fallback) {
alert("failed"+fallback + '!!');
});
}
}
});
:
app.get('/gethistorydata',function(req,res){
console.log("--------------->>>>>>");
console.log("stock name = "+req.params.data);
//res.cookie();
//res.sendFile("F:/customer/public/index.html");
});
req.params.dataは未定義です。構文に何がありますか?
私のparamはparamsと似ています:{st:stock}ここで、在庫はnse:storeoneの形式ですが、これはconsole.http:// localhost:3000/gethistorydata?st = nse:storeone 404(私が "nse:storeone"をセミコロンが無視されないように単一の値としてどのように送るべきですか? –