Internal server error 500 between Angularjs and api

前端 未结 1 611
生来不讨喜
生来不讨喜 2021-01-25 21:58

I am trying to save data from angularjs sending it to an api but i have the error 500 internal server error. the controller is an array hols the scops coming from the html page.

相关标签:
1条回答
  • 2021-01-25 22:41

    Your function on the controller expects an object, but you are trying to post an array. Change it as follows,

    $scope.setup = {
            "Spec_Code": $scope.spec, "Medical_CTG": $scope.deg, "Doctor_Code": $scope.st, "Main_Serv": $scope.stypecode, "Serv_Group": $scope.sgroupcode, "Sub_Serv": $scope.sub,
            "Pat_Type": $scope.patype, "Calc_Type": $scope.calcs, "Calc_From": $scope.rfrom, "Calc_Val": $scope.calcvalue, "STAFF_TYPE": $scope.stafftype,
            "pricelist": $scope.selectedpricelist
        });
    

    also convert to string before posting it using JSON.stringify($scope.setup);

    0 讨论(0)
提交回复
热议问题