angularjs也支持script形式的template

<script type="text/ng-template" id="name">

https://docs.angularjs.org/api/ng/directive/script

<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(by.css('#tpl-link')).click();
  expect(element(by.css('#tpl-content')).getText()).toMatch(/Content of the template/);
});
原文地址:https://www.cnblogs.com/wancy86/p/7063053.html