process timestamps at build time

This commit is contained in:
Athou
2013-05-18 18:50:22 +02:00
parent 07402e584a
commit 868016865a
7 changed files with 34 additions and 11 deletions

View File

@@ -1,36 +0,0 @@
var app = angular.module('commafeed.services');
app.factory('$templateCache', ['$cacheFactory', '$http', '$injector', function($cacheFactory, $http, $injector) {
var cache = $cacheFactory('templates');
var allTplPromise;
return {
get : function(url) {
var fromCache = cache.get(url);
if (fromCache) {
return fromCache;
}
if (!allTplPromise) {
var lang = $('html').attr('lang');
allTplPromise = $http.get('templates/all-templates.' + lang + '.html?${timestamp}').then(
function(response) {
$injector.get('$compile')(response.data);
return response;
});
}
return allTplPromise.then(function(response) {
return {
status : response.status,
data : cache.get(url)
};
});
},
put : function(key, value) {
cache.put(key, value);
}
};
}]);