Problems updating corner changes on a production server

I have a recurring problem that occurs when I make changes to an angularjs application. The problem is that I need to refresh the page if I want to make the changes I made. This is a problem because I do not want my users to refresh the page (maybe they don’t know this). They might think the site is broken. Is there any angular directive or process that I can track that will allow me to change my user interface changes on my production server if my users do not refresh the page?

+7
angularjs javascript-events page-refresh
source share
2 answers

There are several solutions that you might consider

  • Here is a similar answer to your question:

AngularJS disables partial caching on dev machine

To quote the accepted answer to this post:

"here is one way to always automatically clear the cache whenever ng-view content changes"

myApp.run(function($rootScope, $templateCache) { $rootScope.$on('$viewContentLoaded', function() { $templateCache.removeAll(); }); }); 
  1. A solution without angular can also be found here:

Force browser to clear cache

To quote the best answer to this post (Fermin's answer):

If one of the ways to view css or js changes is to add _versionNo to the css / js file for each version. For example.

script_1.0.css script_1.1.css script_1.2.css etc.

You can check this link to find out how it can work.

I hope this helps.

EDIT. To answer your comment, I am sorry that this did not work.

Perhaps you could try to implement a web descriptor approach similar to Trello, during which after a while you ask the user to refresh his page to receive new updates on the system or to update if their socket connection time has been disabled? Depending on your installation, you may find this tutorial useful: http://www.html5rocks.com/en/tutorials/frameworks/angular-websockets/

+7
source share

Using html2js, you can more easily control template versioning. This is a grunt plugin that will load all your templates into a js file. The disadvantage is that all your templates are loaded regardless of the need, at the top there are all your ready-made templates ready for use on one HTTP call and one caching point for them. Thus, you can configure the renaming of your js file to new releases and overlap the cache for templates in production. As for dev, another answer is enough here.

0
source share

All Articles