angularjs - Code changes not taking effect until refresh/reload is clicked -


Any time I make changes to the code in my angle site, they are effective until the user is refreshed Do not click the button. Even if I log out on a page that is not angular then log back in again is the same old code unless I click on the refresh button. So if someone logs in then log in last regardless of the changes and I can not disclose that they refresh each time they log in.

So my question is how do I refresh the code. I do not want to use the window. There is reload or anything that if there is a classical angular way to accomplish this. I tried to clean the template cache but it does not work, this is what I tried:

  .run (function ($ Rootscope, $ template cache) {$ templateCache. RemoveAll (); $ rootsecope. $ ('$ RouteChangeStart', function (event, next, running) {if (typeof (current)! == 'undefined') {$ templateCache.remove (current.templateUrl);}}} ;}}   

My problem is in case of browser caching JS file I do not think Was that the problem would be because the initiative I never had this problem to use the angular railway. So I found this to fix this issue: and modified it a bit, so I did not leave all the URLs again. < P> I added the PHP function

  function get_version ($ file) {return file time ($ _ server ['DOCUMENT_ROOT']. $ File);}  
< P> Then where do I link my script:

  & lt; script src = "/ path / to / script.js? & Lt; Php echo get_version ('/ path / to / script.js') ;? & Gt; "& Gt; & lt; / script & gt;  

Comments