You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Feb 26, 2024. It is now read-only.
I tried to follow the guide to write a directive, but as soon as I switched from template to templateUrl, I found that I could edit my template .html file but the browser wouldn't reload my changes.
The problem turned out to be that, when I did npm start to start http-server, my template file was being sent back with a cache-control: max-age=3600 HTTP header, telling my browser to cache the file, and not even check again, for an hour. When I hit Reload, the browser would reload the top-level page despite this header, and it would reload the templates for my routes, but neither Chrome nor Firefox would reload the templates for my directives -- for those templates, they took the cache-control header very seriously.
The http-server docs mention that there's a parameter to configure the cache-control header, and it fixed the problem. The fix is to change this line in package.json:
"start": "http-server -a localhost -p 8000",
to:
"start": "http-server -a localhost -p 8000 -c-1",
The text was updated successfully, but these errors were encountered:
joewhite
added a commit
to joewhite/lpc-chargen
that referenced
this issue
May 23, 2014
Disable the local HTTP server's cache-control header, to fix the problem where the browser wouldn't reload templateUrl-based directive templates. Fixesangular#193.
I tried to follow the guide to write a directive, but as soon as I switched from template to templateUrl, I found that I could edit my template .html file but the browser wouldn't reload my changes.
The problem turned out to be that, when I did
npm start
to start http-server, my template file was being sent back with acache-control: max-age=3600
HTTP header, telling my browser to cache the file, and not even check again, for an hour. When I hit Reload, the browser would reload the top-level page despite this header, and it would reload the templates for my routes, but neither Chrome nor Firefox would reload the templates for my directives -- for those templates, they took thecache-control
header very seriously.The http-server docs mention that there's a parameter to configure the
cache-control
header, and it fixed the problem. The fix is to change this line in package.json:to:
The text was updated successfully, but these errors were encountered: