Following is the code which you can use to add version with html template URL, please look into it.
<add key="CURRENT_VERSION" value="4_0"/>
</appSettings>
var CurrentVersion = '@ViewBag.CurrentVersion';
.config(['$httpProvider', function ($httpProvider) {
$httpProvider.interceptors.push('httpInterceptorVersion');
}])
.factory('httpInterceptorVersion', function () {
return {
request: function (config) {
if ((config.method === "GET") && (config.url.match(/\.\html?$/))) {
config.url += '?v=' + CurrentVersion;
// here you can target particular folder file
//if (config.url.indexOf("template/") !== 0) {
// config.url += '?v=' + currentVersion;
//}
}
return config;
}
};
});
I hope it might be helpful to manage caching issue.
Web.config file:
<appSettings><add key="CURRENT_VERSION" value="4_0"/>
</appSettings>
Index.cshtml file:
var CurrentVersion = '@ViewBag.CurrentVersion';
app.js file:
angular.module('app', []).config(['$httpProvider', function ($httpProvider) {
$httpProvider.interceptors.push('httpInterceptorVersion');
}])
.factory('httpInterceptorVersion', function () {
return {
request: function (config) {
if ((config.method === "GET") && (config.url.match(/\.\html?$/))) {
config.url += '?v=' + CurrentVersion;
// here you can target particular folder file
//if (config.url.indexOf("template/") !== 0) {
// config.url += '?v=' + currentVersion;
//}
}
return config;
}
};
});
I hope it might be helpful to manage caching issue.