Meteor_angularjs icon indicating copy to clipboard operation
Meteor_angularjs copied to clipboard

files in directives directory that are used as templates are cached by the browser even when autoreloaded

Open xiphias opened this issue 12 years ago • 3 comments

I'm using html files in the partials/directives directory as html templates. When I change a file, the application reloaded, but the browser caches the template, so a refresh itself doesn't help either, only clearing the browser cache. It looks like the problem is that AngularJS doesn't send if-modified-since and if-none-match headers to the server.

xiphias avatar Dec 14 '12 01:12 xiphias

A quick fix is to disable caching for templates: Put this in app.js configuration (after injecting $httpProvider service) $httpProvider.defaults.headers.common['Cache-Control']='no-cache'

xiphias avatar Dec 15 '12 08:12 xiphias

Thank you @xiphias I will keep this issue open so other people can see your solution. I will try to do something neat in the package itself to make sure it works.

lvbreda avatar Dec 17 '12 10:12 lvbreda

Actually I think this is a missing feature from AngularJS...I looked at the XMLHTTPRequest implementation and they don't support caching. JQuery library has the extra logic for it, so we should probably file a bug for AngularJS guys.

xiphias avatar Dec 17 '12 15:12 xiphias