How to force update angular module files on version update

I am developing a large angular.js / mvc webapi SPA that is on private networks. When I install a new version of the app on a client site using the installer, the client browser software just keeps working with the old module, even during login / logout. The browser just uses the cached version of the main application module.

In the past on other platforms like ASP.NET, I have used a web service that publishes a version and added? version = 123 to each request for a javascript resource to force the client version to stay up to date, no matter how aggressively the client browser caches javascript files.

What is the best strategy for solving this problem in a single in-memory application. If I hit a webservice in angular, how can I bypass the route provider and just force it to reload the actual javascript file that hosts the main application module?

What is the strategy set by web application developers in the angular space to solve this problem?

+3


source to share


1 answer


I don't have 50 reputation points yet, so I can't comment and I leave that as an answer.

In our project, we are using TeamCity

web applications to deploy, and we are using a console application that runs during the deployment phase. The console application is used T4 template

for index.html

transformations on every deployment. This is how we add the version parameter to the script url. T4 templates

can be replaced by an engine razor

or any other technology.



Another approach is to ASP.NET

only use to get the main view, but I prefer not to include ASP.NET

in a web application for just one simple task.

However, I think our solution looks too heavy and I wonder if there is a simpler solution.

+1


source







All Articles