So currently, I have a method that adds my objects to my database. It works, and is written as such:
var $scope.insertToDB = function(myObj){
$http.put("my_DB_Link", myObj).then(function(success){
console.log(success);
},function(error){
console.log(error);
}
}
I figured that updating this object would be fairly easy, but so far, I have been proven wrong. I have used GET to test to assure my data is in there, and so far it is, but with an "_id" tag added onto it. Now, I figured that I could use the same method to update the data:
var $scope.updateObjInDB = function(myObj){
$http.put("my_DB_Link", myObj).then(function(success){
console.log(success);
},function(error){
console.log(error);
}
}
But, this always returns a 400 Bad Request exception. When I replace the "put" with "get" it gets the data without a problem it seems, however, it doesn't seem like you can update the object with the "put" call. Also, "post" throws a 405 Method Not Allow exception. How do I update my object using a similar method my insertToDB() function?