I'm new to angular and having trouble with a service that always worked, until it didn't. My service has the following call.
this.getForms = function() {
return $http.get("/forms").
then(function(response) {
return response;
}, function(response) {
alert("Error finding forms.");
});
};
When the page is refreshed (safari) getForms is trigged, $http.get is called, my Node.js/Express server forms endpoint returns the forms data properly.
app.get("/forms", function (req, res) {
Form.find({}, function (err, docs) {
if (err) {
server.handleError(res, err.message, "Failed to get forms.");
} else {
res.status(200).json(docs);
}
});
});
But instead of the JSON I get a 304 error, which indicates the data is available in cache. But the 304 response header has an empty data string, so it's not returning any data from the cache.
My questions are
1) Why is it calling my server if the data is available in cache?
2) How can I tell it to not cache this call so the page can update with forms correctly?