1
我有一些Restangular和獲取/放置元素的問題。 首先,如果我嘗試獲取一個元素,則會收到帶有交叉起點的錯誤。Restangular失敗並在嘗試GET/PUT時生成URL
Restangular.one('api/label-resource', 1).get().then(function(success) {
// Change some propertries
success.put();
}
XMLHttpRequest cannot load http://localhost:3000/api/template/1. The request was redirected to 'http://localhost:3000/api/label-resource/1/', which is disallowed for cross-origin requests that require preflight.
如果我嘗試用PUT失敗原因是試圖達到http://localhost/api/label-resource/1/1/
Restangular.oneUrl('api/label-resource/1/').get().then(function(success) {
// Change some properties
success.put();
}
我的REST API的URL獲得它是Django的REST的框架。