Javascript 如何在jasmine angularjs测试中从模板html注入脚本标记

Javascript 如何在jasmine angularjs测试中从模板html注入脚本标记,javascript,jquery,angularjs,jasmine,karma-jasmine,Javascript,Jquery,Angularjs,Jasmine,Karma Jasmine,我试图在模板html中插入一个脚本标记,供jasmine用于运行测试用例。 假设html文件是: <script> <!-- imagine there is some cool javascript code in here - actual code not a link--> </script> <div> <h2>Imagine a question here?</h2> <input typ

我试图在模板html中插入一个脚本标记,供jasmine用于运行测试用例。 假设html文件是:

<script>
 <!-- imagine there is some cool javascript code in here - actual code not a link-->
</script>
<div>
    <h2>Imagine a question here?</h2>
    <input type="checkbox">Yes</input>
    <input type="checkbox">No</input>
</div>


但是这些都不起作用(或者抛出任何错误)

getScript方法加载并执行JavaScript文件。为什么要加载HTML文件?可以应用hi-javascript。但我认为它在完全加载dom后可以工作。所以请在本文末尾定义它file@georgeawg我正在尝试加载html中脚本标记中的javascriptfile@LDS在spec.ts文件的末尾,AngularJS框架不支持中的
元素模板文件。JavaScript应该放在控制器中,并注入
ng controller
指令。
$.getScript('link/to/html/page.html');
require('link/to/html/page.html');