Cache with AngularJS

0

I have an application with AngularJs , in this application when I make some changes and then deploy the browser does not recognize those changes. It only works when I change the URL of that application.

I got some tips here from SOpt to use querystring with Timestamp , but I'd like to try to solve this problem using something like AngularJS

Would there be any way to disable or handle the cache so that this problem does not happen?

    
asked by anonymous 27.01.2016 / 13:26

1 answer

1

The browser does not recognize because the AngularJs.js script already exists in the browser cache. For any script to be reloaded, why do not you try to use window.location.reload(true) . If you want another alternative, I would advise you to do a rand() function when you load AngularJs.js and add it as a "parameter" GET, so the path will always be "changed" and the browser will understand that it is download this new script.

Example with PHP :

<script src=\"AngularJs.js?r=<?php echo rand(0,10); ?>" type=\"text/javascript\"></script>
    
24.02.2016 / 15:19