user3055606
user3055606

Reputation: 65

AngularJS (500 Internal Server Error) for http put

I want to update the record to the api.

In my firebug it shows:

500 internal server error,

XML Parsing Error: no element found Location: moz-nullprincipal:{f514f16e-f3d3-49f1-99e6-105b2b80f26c} Line Number 1, Column 1:

and also under put it shows:

There are no child objects

Here is my code

$scope.EditUser = function(){
    $scope.ApplicationId = '7bg67898ewnbqjq65e';

$http.put("mydomain.com/api/Users/UpdateUser", {}, {
   params: { _id: $scope.selectedItem._id, ApplicationId: $scope.ApplicationId, User_Name : $scope.selectedItem.UserName, IsActive: $scope.selectedItem.IsActive }
});

Upvotes: 0

Views: 2537

Answers (2)

Oron Bendavid
Oron Bendavid

Reputation: 1533

The shortcut method to perform PUT request is: $http.put(url, data, [config]); @user3055606 your Answer is correct.

Upvotes: 1

user3055606
user3055606

Reputation: 65

This is solved using this

$scope.EditUser = function(){
    $scope.ApplicationId = '7bg67898ewnbqjq65e';

$http.put("mydomain.com/api/Users/UpdateUser", {
    _id: $scope.selectedItem._id, ApplicationId: $scope.ApplicationId, User_Name : $scope.selectedItem.UserName, IsActive: $scope.selectedItem.IsActive 
});

Upvotes: 1

Related Questions