diff options
| author | Misko Hevery | 2012-01-24 22:42:33 -0800 |
|---|---|---|
| committer | Misko Hevery | 2012-01-25 11:50:37 -0800 |
| commit | e2b1d9e994e50bcd01d237302a3357bc7ebb6fa5 (patch) | |
| tree | a49246c84ba1dc0c34525fbe9819d5f649282be5 /src | |
| parent | 9ee2cdff44e7d496774b340de816344126c457b3 (diff) | |
| download | angular.js-e2b1d9e994e50bcd01d237302a3357bc7ebb6fa5.tar.bz2 | |
feat(scriptTemplateLoader): provide template inlining
populates $templateCache with content of ng-template scripts
Diffstat (limited to 'src')
| -rw-r--r-- | src/AngularPublic.js | 1 | ||||
| -rw-r--r-- | src/widgets.js | 12 |
2 files changed, 13 insertions, 0 deletions
diff --git a/src/AngularPublic.js b/src/AngularPublic.js index 516bbad4..d052c35b 100644 --- a/src/AngularPublic.js +++ b/src/AngularPublic.js @@ -69,6 +69,7 @@ function publishExternalAPI(angular){ input: inputDirective, textarea: inputDirective, form: ngFormDirective, + script: scriptTemplateLoader, select: selectDirective, option: optionDirective, ngBind: ngBindDirective, diff --git a/src/widgets.js b/src/widgets.js index cf32bdc1..68c40b92 100644 --- a/src/widgets.js +++ b/src/widgets.js @@ -813,3 +813,15 @@ var ngPluralizeDirective = ['$locale', '$interpolate', function($locale, $interp }); }; }]; + + +var scriptTemplateLoader = ['$templateCache', function($templateCache) { + return { + compile: function(element, attr) { + if (attr.type == 'text/ng-template') { + var templateUrl = attr.id; + $templateCache.put(templateUrl, element.text()); + } + } + }; +}]; |
