2016-08-03 11 views
1

Ich habe $ scope.todos und in meinem Controller den Code für das Einreichen

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

    //code goes here for sending variable 
} 

Und ich möchte es Knoten senden. js, die es dauert, wie:

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); 
    }) 
}) 

Antwort

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

können wir diese mit $ Ressource nicht statt $ http. Danke .. – SaiUnique

+0

ja Sie müssen dies mit $ Ressource –

+0

überprüfen aktualisierte Antwort –