2016-08-03 47 views
1

我有$ scope.todos Node.js的服务器,并在我的控制器代码提交即

$scope.submitChanges = function() { 
    var todos = $resource("/todo"); 

    //code goes here for sending variable 
} 

我想将它发送到节点。 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); 
    }) 
}) 

回答

0
var CreditCard = $resource('/todos/:Id', 
{userId:123, Id:'@id'}, { 
charge: {method:'POST', params:{charge:true}} 
}); 
+0

我们不能做到这一点使用$资源,而不是使用$ HTTP。谢谢.. – SaiUnique

+0

是的,你必须这样做使用$资源 –

+0

检查更新的答案 –