<input type="text" ng-model="project_name"/>
<button ng-click="add_project()">Add Project</button>
$scope.add_project = function add_project(){
console.log($scope.project_name);
$http.post('/projects', $scope.project_name).success(function(response) {
console.log(response);
refresh();
});
};
app.post('/projects',function (req, res){
console.log(req.body);
db.projects.insert(req.body, function(err, doc) {
res.json(doc);
});
});
当我点击按钮时,我收到错误:
angular.js:11821 PUT http://localhost:8080/projects1 400(错误请求)
不确定如何解决此问题。