![](/img/trans.png)
[英]Angular: how to pass $scope variables into the Node.js server.
[英]How to pass $scope variables into the Node.js server using $resource
我有$ scope.todos,在我的控制器中提交的代碼是
$scope.submitChanges = function() {
var todos = $resource("/todo");
//code goes here for sending variable
}
我想將它發送到Node.js,它將其作為:
router.post("/",function(req, res) {
var collection = db.get("todo");
collection.insert({ /* here comes the data to insert */ }, function(err, todos) {
if(err) throw err;
res.json(todos);
})
})
var CreditCard = $resource('/todos/:Id',
{userId:123, Id:'@id'}, {
charge: {method:'POST', params:{charge:true}}
});
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.