簡體   English   中英

如何使用$ resource將$ scope變量傳遞到Node.js服務器

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM