diff --git a/lib/html2js.js b/lib/html2js.js index cc734b0..3ac5e1c 100644 --- a/lib/html2js.js +++ b/lib/html2js.js @@ -1,9 +1,9 @@ var util = require('util'); -var TEMPLATE = 'angular.module(\'%s\', []).run(function($templateCache) {\n' + +var TEMPLATE = 'angular.module(\'%s\', []).run([\'$templateCache\', function($templateCache) {\n' + ' $templateCache.put(\'%s\',\n \'%s\');\n' + - '});\n'; + '}]);\n'; var SINGLE_MODULE_TPL = '(function(module) {\n' + 'try {\n' + @@ -11,9 +11,9 @@ var SINGLE_MODULE_TPL = '(function(module) {\n' + '} catch (e) {\n' + ' module = angular.module(\'%s\', []);\n' + '}\n' + - 'module.run(function($templateCache) {\n' + + 'module.run([\'$templateCache\', function($templateCache) {\n' + ' $templateCache.put(\'%s\',\n \'%s\');\n' + - '});\n' + + '}]);\n' + '})();\n'; var escapeContent = function(content) { diff --git a/test/helpers/template_cache.coffee b/test/helpers/template_cache.coffee index bcb3c87..0c89d0c 100644 --- a/test/helpers/template_cache.coffee +++ b/test/helpers/template_cache.coffee @@ -7,7 +7,8 @@ module.exports = (chai, utils) -> templates = @templates = {} run: (block) -> - block + # Block is an annotation array ["$templateCache", function($templateCache) {..}] + block[1] put: (id, content) => @templates[id] = content