1
간단한 ASP.NET Web API 2 서비스가 있습니다. Angular에서 새로운데, $ http를 Restangular로 바꾸려고합니다. 내 GET은 괜찮은 것처럼 보이지만 POST는 그렇지 않습니다.
$scope.addLift = function() {
$http.post(url, $scope.Lift);
//Restangular.all('lifts').post('Lift', $scope.Lift).then(function (newLift) {
// $scope.getLifts();
//}, function (error) {
// console.log(error);
//});
};
주석 처리 Restangular 코드가 작동하지 않지만, $ http.post을 수행하고 내가 잘못 뭘하는지 확실하지 않다 :
코드는 다음과 같습니다.
유용한 경우, Restangular를 사용할 때의 POST는 http://localhost/api/lifts?LiftName=test
입니다. POST 요청시 $http
POST 요청에 URL 행에 매개 변수가 없으므로 데이터가 요청 본문에있는 것 같습니다.