Files
stf-DeviceFarmer/res/app/components/stf/common-ui/include-cached/compile-cache-service.js
Gunther Brunner 692582ce3d Finally fixed disappearing headers from dynamic columns.
Bind-once optimizations.
2014-06-23 14:32:27 +09:00

17 lines
518 B
JavaScript

module.exports = function ($http, $templateCache, $compile) {
var cache = {}
return function (src, scope, cloneAttachFn) {
var compileFn = cache[src]
if (compileFn) {
compileFn(scope, cloneAttachFn)
} else {
$http.get(src, { cache: $templateCache }).success(function (response) {
var responseContents = angular.element('<div></div>').html(response).contents()
compileFn = cache[src] = $compile(responseContents)
compileFn(scope, cloneAttachFn)
})
}
}
}