-
Notifications
You must be signed in to change notification settings - Fork 119
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Angularjs 1.1.5 doesn't work for me #16
Comments
I think your issue may be due to this commit: angular/angular.js#1004 As it says in the commit, just add this to your module:
|
@ndemoreau - Let me know if @NickClark's solution fixes your issues. |
I just spent some time digging into Angular and Rails to really understand this issue as it relates to $resource in a Rails environment. It turns out that Rails is a bit cagey about utilizing the Accepts header from an HTTP request. It has to have the So an alternative to adding the App.factory('Record', function($resource) {
return $resource("/records/:id", {
id: "@id"
}, {
update: {
method: "PUT"
},
query: {
isArray: true,
method: "GET",
headers: {
"Accept": "application/json",
"X-Requested-With": "XMLHttpRequest"
}
}
});
}); |
@gwright wont that only work for query requests so all your other requests will fail? |
@eddiemonge I haven't looked at this in a while but generally the other types of requests (PUT, POST, DELETE) have an empty body and so the format of an empty response is somewhat irrelevant. In those cases it is the status code that is of interest. So perhaps it would be more correct send an explicit accepts header on all types of HTTP requests. Sending X-Requested-With is still problematic with respect to CORS process though, as I understand it. |
Sounds like several solutions have been provided. Also this isn't an issue with angularjs-rails, so can this be closed? 👍 |
Closing this issues. |
Just to let you know. I didn't have time to investigate but I think it's linked to angular-resource.
It loads but not my data.
The text was updated successfully, but these errors were encountered: