2
app.directive('myDirective',function() {
    return {
         restrict : 'A', 
         templateUrl : 'app/html.html'
       };
});

I'm running into a problem with template html getting cached in the internet explorer. Every time the html is changed, either one of these need to be done to load the new templete:

  1. Delete browsing history and clear temporary internet files.
  2. Change browser setting 'Check for newer versions of stored pages' from Automatic to 'Every time I visit'

A similar problem is stated Here. The marked answer works, but was thinking if there is any better solution to the problem rather than defeating the browser caching.

Community
  • 1
  • 1
Narain Mittal
  • 1,150
  • 11
  • 25

2 Answers2

2

You must use app version and increase after each update:

<html data-ver="1.0">

And in your js code:

// for example: read app version from data-ver attribute on html tag
window.appVersion = angular.element(document.getElementsByTagName('html')).attr('data-ver');

app.directive('myDirective',function() {
    return {
         restrict : 'A', 
         templateUrl : 'app/html.html?v=' + window.appVersion
       };
});
MBN
  • 1,006
  • 7
  • 17
0

I had this issue with changes that I made to my templates. I was able get rid of the single template file that I needed to by following these steps:

  1. Open Internet Explorer
  2. Click the Tools (Alt-X) button and then click Internet Options
  3. Click the General tab, and then under Browsing history, slick Settings
  4. In the Temporary Internet Files and History Settings dialog box, click View Files
  5. Locate the template file that you have modified and delete it.

I hope this helps.