Files
stf-DeviceFarmer/res/app/components/stf/common-ui/include-cached/include-cached-directive.js
2016-01-19 23:08:33 +09:00

18 lines
469 B
JavaScript

module.exports = function includeCachedDirective(CompileCacheService) {
return {
restrict: 'ECA',
terminal: true,
compile: function(element, attrs) {
var srcExp = attrs.ngIncludeCached || attrs.src
return function(scope, element) {
var src = scope.$eval(srcExp)
var newScope = scope.$new()
CompileCacheService(src, newScope, function(compiledElm) {
element.append(compiledElm)
})
}
}
}
}