1
我用角$resource
服務,使HTTP調用請求的URL,如
var reportEndpoint = $resource('http://example.org/:id');
reportEndpoint.get({id: 6}, function (response, responseHeaders) {
$scope.report = response.data;
// can I get here the URL that the request was submitted to
});
在由註釋指出的一點,是有一些方法來獲取URL的請求已提交到,在上面的示例中,這將是http://example.org/6
爲什麼要在此時請求的URL? – dnc253
你能更具體嗎?我只是不明白爲什麼會有基於URL的業務邏輯,而不是基於對象的屬性。 – dnc253
任何你不能只做'var reportUrl ='http://example.org/:id,reportEndpoint = $ resource(reportUrl)的原因? – jperezov