我想知道$ http是否可以使用LINK / UNLINK方法向POST服务器发送ajax请求(如POST,GET,PUT,PATCH ..)。我已经在AngularJS文档中搜索,只找到了这个可用方法列表:
当您想要仅在资源之间建立关系时,LINK方法非常有用,如果它缺失则真的很遗憾。如果有人知道如何做这个请求,可以给我一个例子吗?
LINK / UNLINK方法示例:
There exists a broad range of possible use cases for the LINK and UNLINK methods. The examples that follow illustrate a subset of those cases.
Example 1: Creating two separate links between an image and the profiles of two people associated with the image:
LINK /images/my_dog.jpg HTTP/1.1
Host: example.org
Link: <http://example.com/profiles/joe>; rel="tag"
Link: <http://example.com/profiles/sally>; rel="tag"
Example 2: Removing an existing Link relationship between two resources:
UNLINK /images/my_dog.jpg HTTP/1.1
Host: example.org
Link: <http://example.com/profiles/sally>; rel="tag"
以下是有关LINK方法的一些文档:
http://www.w3.org/Protocols/HTTP/Methods/Link.html
http://tools.ietf.org/id/draft-snell-link-method-01.html#RFC5988
答案 0 :(得分:0)
如果不使用$http
方法检查是否存在请求
OPTIONS
而不使用这些简短方法,这可能会有效
$http({method: 'LINK', url: '/someUrl'}).
success(function(response){
//do something fancy
})
答案 1 :(得分:0)
不,抱歉,默认情况下,AngularJS无论如何都不提供LINK请求。
所以你有选择: