'if i using angularjs function excel upload button function how to write my code

I writed code

$scope.updatepricingimport = function(file) {
            debugger
            if(file == null || file == undefined || file == "")
            {
                toastr.error("Please Select file");
                angular.element("#shipmentdata").modal("show");
                return false;
            }
            $scope.showlodebar = true;
            var fd = new FormData();
            fd.append("file", file);
            return $http
                .post(
                    $localStorage.apiURL +
                    "/Leaserate/ValidatepricingsUpload?id=" +
                    $scope.pricing.pricingId,
                    fd, {
                        transformRequest: angular.identity,
                        credentials: "include",
                        cache: "no-cache",
                        mode: "cors",
                        headers: {
                            "Content-Type": undefined,
                        },
                    }
                )
                .then(function(response) {
                    debugger
                if (response.data.errorUpload == true) {
                    $scope.items = response.data.uploadError;
                    $scope.ShowError = true;
                    angular.element("#shipmentdata").modal("hide");
                    toastr.error(" Upload Please find the document downloaded for details");
                    
                } else {
                    toastr.success("Shipment Uploaded successfully");
                    $scope.checktankimport = true;
                    $scope.getAllPricings();
                    // $scope.LCTankTypesListLen = $scope.LCTankTypesList.length;
                }

                // $scope.LCTankTypesList = response.data.lstanktypelist;
                // $scope.LCTankTypesListLen = $scope.LCTankTypesList.length;
                // $scope.Tanklen = $scope.LCTankTypesList.length;
                $scope.showlodebar = false;
                // $scope.applyLCTankTypePage(1);

            })
            .catch(function(response) {
                console.log(response);
            });
    }

Error in my code

enter image description here

enter image description here



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source