【发布时间】:2015-07-08 00:10:57
【问题描述】:
是否可以使用AngularJS $http 服务来参数化一个restful url?例如:
var URL = '/api/countries/:countryId/states'
var getStates = function (countryId) {
$http.get(URL, { countryId: countryId }).then();
};
我尝试的每个组合最终都使用了一个查询字符串,这不是我想要的。
【问题讨论】:
-
阅读此stackoverflow.com/questions/5216567/…。我想angularjs在使用get方法时总是使用查询字符串而不是body,如果你改为post,你会看到body
-
@G.Deward 尝试使用$resource
标签: angularjs