Force reload of a directive’s template

I know this is an old question, but here’s a simpler fix, although it’s a bit of a hack, it works for me, and doesn’t require you to do anything to $templateCache.

Whenever I run into this problem (I see it in directive templates, but also static JSON files), I add a query parameter to the end of the URL being loaded, like this:

...
templateUrl: "partials/template.html?1",
...

Whenever I make a changes to the template, and it’s not reloading, I increment that number at the end. As the browser doesn’t know if this might mean something special to the server, it should attempt to reload that changed URL whether it’s cached or not. This will also make sure the file is reloaded in the production environment.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)