[英]PUT ERROR 404 (Not Found) in playframework with restangular
我在表中顯示了一系列的客戶,並且我使用相同的方式來添加和更新客戶,因此我對id進行了測試,以區分是否單擊“添加”按鈕是要添加還是更新:
$scope.saveCustomer = function(customer){
if ($scope.customer.uid){
$scope.customer = customer;
$scope.customer.contacts = customer.contacts;
$scope.customer.put();
}
else{
Restangular.all("customer").post(customer).then(function() {
$scope.customerList.push(customer);
console.log("success");
},function(response){
console.log(response);
});
}
};
添加工作正常,但在推入操作中出現此錯誤:
更新:
我應該提到我在客戶對象中有一個列表聯系人,因此當我更新客戶時,我也會同時更新一些聯系人字段,並且我使用的是mongodb,並且我在postman上測試了put方法,並且運行良好
根據您的路由配置,您沒有為方法PUT到/ customer location定義路由。
在您的conf / routes中嘗試添加:
PUT /customer controllers.CustomerController.__method_to_process_put__
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.