diff options
| author | Vojta Jina | 2012-02-28 12:00:32 -0800 |
|---|---|---|
| committer | Vojta Jina | 2012-02-28 14:15:44 -0800 |
| commit | b37e8a2b141761d3211b52b8b6802c49c92d44f8 (patch) | |
| tree | 794d7746811ea1cff317cdc4f95197da5d200d8a | |
| parent | 4c1c50fd9bfafaa89cdc66dfde818a3f8f4b0c6b (diff) | |
| download | angular.js-b37e8a2b141761d3211b52b8b6802c49c92d44f8.tar.bz2 | |
docs(directive.script): Add simple example of inlined template
| -rw-r--r-- | src/widgets.js | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/widgets.js b/src/widgets.js index d515d94d..adc373e0 100644 --- a/src/widgets.js +++ b/src/widgets.js @@ -781,6 +781,32 @@ var ngPluralizeDirective = ['$locale', '$interpolate', function($locale, $interp }]; +/** + * @ngdoc widget + * @name angular.module.ng.$compileProvider.directive.script + * + * @description + * Load content of a script tag, with type `text/ng-template`, into `$templateCache`, so that the + * template can be used by `ng:include` or `ng:view`. + * + * @example + <doc:example> + <doc:source> + <script type="text/ng-template" id="/tpl.html"> + Content of the template. + </script> + + <a ng:click="currentTpl='/tpl.html'" id="tpl-link">Load inlined template</a> + <div id="tpl-content" ng-include src="currentTpl"></div> + </doc:source> + <doc:scenario> + it('should load template defined inside script tag', function() { + element('#tpl-link').click(); + expect(element('#tpl-content').text()).toMatch(/Content of the template/); + }); + </doc:scenario> + </doc:example> + */ var scriptTemplateLoader = ['$templateCache', function($templateCache) { return { terminal: true, |
