Skip to content

Commit d687049

Browse files
author
Kamil Kisiela
committed
feat(templates): exports templateUrl
Closes #1313
1 parent e657e8d commit d687049

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

packages/angular-templates-runtime/ng-template-compiler.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,16 @@ var minifyHtml = function(html) {
101101
});
102102
};
103103

104-
function wrapAngularTemplate(id, contents) {
105-
return "angular.module('angular-templates').run(['$templateCache', function($templateCache) { $templateCache.put('" +
106-
id + "'," + JSON.stringify(contents) + ");}]);";
104+
function wrapAngularTemplate(templateUrl, contents) {
105+
return `
106+
angular.module('angular-templates')
107+
.run(['$templateCache', function($templateCache) {
108+
$templateCache.put('${templateUrl}', ${JSON.stringify(contents)});
109+
}]);
110+
if (typeof module !== 'undefined' && module.exports) {
111+
module.exports = "${templateUrl}";
112+
}
113+
`;
107114
}
108115

109116
StaticHtmlTagHandler.init = function(tags) {

0 commit comments

Comments
 (0)