javascript - Examples of using $http.put in Angular? - Stack Overflow

Are there any simple examples of using the $http.put method in Angular? Specifically, I'm unsure a

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]);

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]);
Share edited Nov 28, 2017 at 10:12 Phonolog 6,5213 gold badges39 silver badges64 bronze badges asked Jun 18, 2015 at 11:17 Jorge BushJorge Bush 711 silver badge6 bronze badges 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); – Virtual Realist 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. – Chris22 Commented May 21, 2019 at 16:29
Add a ment  | 

2 Answers 2

Reset to default 5

Second parameter must be an object:

$http.put('/api/v1/users/' + user.login, { login: "login", password: "password" }); 

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

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

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742294927a4416923.html

相关推荐

  • javascript - Examples of using $http.put in Angular? - Stack Overflow

    Are there any simple examples of using the $http.put method in Angular? Specifically, I'm unsure a

    19小时前
    10

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信