AngularJS将数据传递到$ http.get请求

ε祈祈猫儿з 提交于 2020-08-14 05:26:36

问题:

I have a function which does a http POST request. 我有一个执行http POST请求的函数。 The code is specified below. 该代码在下面指定。 This works fine. 这很好。

 $http({
   url: user.update_path, 
   method: "POST",
   data: {user_id: user.id, draft: true}
 });

I have another function for http GET and I want to send data to that request. 我为http GET提供了另一个功能,我想将数据发送到该请求。 But I don't have that option in get. 但是我没有那个选择。

 $http({
   url: user.details_path, 
   method: "GET",
   data: {user_id: user.id}
 });

The syntax for http.get is http.get的语法是

get(url, config) 获取(URL,配置)


解决方案:

参考一: https://stackoom.com/question/vjcc/AngularJS将数据传递到-http-get请求
参考二: https://oldbug.net/q/vjcc/AngularJS-passing-data-to-http-get-request
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!