Load content of a script tag, with type text/ng-template
, into $templateCache
, so that the
template can be used by ngInclude
, ngView
or directive templates.
<script type="text/ng-template"> </script>
type – {'text/ng-template'} –
must be set to 'text/ng-template'
<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>
it('should load template defined inside script tag', function() { element('#tpl-link').click(); expect(element('#tpl-content').text()).toMatch(/Content of the template/); });