I have problem with caching partials in AngularJS.
In my HTML page I have:
<body>
<div ng-view></div>
<body>
where my partials are loaded.
When I change HTML code in my partial, browser still load old data.
Is there any workaround?
I have problem with caching partials in AngularJS.
In my HTML page I have:
<body>
<div ng-view></div>
<body>
where my partials are loaded.
When I change HTML code in my partial, browser still load old data.
Is there any workaround?
As mentioned in the other answers, here and here, the cache can be cleared by using:
However as suggested by gatoatigrado in the comment, this only appears to work if the html template was served without any cache headers.
So this works for me:
In angular:
You may be adding cache headers in a variety of ways but here are a couple of solutions that work for me.
If using
IIS
, add this to your web.config:If using Nginx, you can add this to your config:
Edit
I just realised that the question mentioned
dev
machine but hopefully this may still help somebody...