【问题标题】:angularjs $http.put changes my URLangularjs $http.put 更改我的网址
【发布时间】:2014-08-21 21:02:35
【问题描述】:

我试图用 angularjs 发出 $http.put 请求。 我所做的只是:

$http.put("http://mi-url/personalized_product_custom_pages/2")

它真正做的是一个请求:

"http://mi-url/personalized_product_custom_pages"

有人知道它为什么会更改我的网址吗?怎么添加id?

提前致谢!

【问题讨论】:

  • 最后是内部错误。这个问题应该被删除

标签: angularjs http request angularjs-http


【解决方案1】:

你可以试试,$http.put(url, data);而不是直接给出数据。 参考:https://docs.angularjs.org/api/ng/service/$http#put

【讨论】:

  • 你能准确回答这个问题吗?我一直在尝试不同的语法,但它还不起作用......
【解决方案2】:

试试params:

$http.put("http://mi-url/personalized_product_custom_pages", params:{id:2})

【讨论】:

猜你喜欢
  • 2016-03-26
  • 1970-01-01
  • 2013-03-02
  • 2011-02-09
  • 1970-01-01
  • 2018-01-03
  • 2016-04-01
  • 2012-01-22
  • 2013-01-26
相关资源
最近更新 更多