6

Are there any simple examples of using the $http.put method in Angular? Specifically, I'm unsure about what the data/Request content parameter should be, should it be an object or an object property?

$http.put(url, data, [config]);
2
  • 1
    $http.put method is used for updating the data in the server. i.e., If you are having students' records, then using their ID, you can edit (or) update the data. '$http.put('Some-api/students/'+stuId+'/'+data); Commented Jun 18, 2015 at 11:28
  • @VirtualRealist in your example, what is "+data"? I'm trying to understand how to write params in the path of the http.put request. Thanks. Commented May 21, 2019 at 16:29

2 Answers 2

5

Second parameter must be an object:

$http.put('/api/v1/users/' + user.login, { login: "login", password: "password" }); 
Sign up to request clarification or add additional context in comments.

Comments

1

I use $http.put like this in my project.

$http.put(api/resources/:id, {name:name});

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.