簡體   English   中英

在帶有矩形的播放框架中出現PUT錯誤404(未找到)

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM