Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/372.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 脚本中的角度外部模板_Javascript_Angularjs_Angular Template - Fatal编程技术网

Javascript 脚本中的角度外部模板

Javascript 脚本中的角度外部模板,javascript,angularjs,angular-template,Javascript,Angularjs,Angular Template,使用模板时,我们可能会将应用程序托管在Web服务器上,否则会导致跨源错误。因此,我将模板放在脚本标记中,如下所示: <script type="text/ng-template" id="/home.html"> some text goes here </script> 通过使用以下标志打开chrome浏览器,可以防止此错误 chrome.exe --disable-web-security --allow-file-access-from-files 打开cmd并

使用模板时,我们可能会将应用程序托管在Web服务器上,否则会导致跨源错误。因此,我将模板放在脚本标记中,如下所示:

<script type="text/ng-template" id="/home.html">
some text goes here
</script>

通过使用以下标志打开chrome浏览器,可以防止此错误

chrome.exe --disable-web-security --allow-file-access-from-files
打开cmd并在命令上方运行

注意

在运行上述命令之前,请确保浏览器已关闭


希望有帮助。

这是毫无意义的。你不能让每个用户都以禁用安全模式打开浏览器。这是为了在本地测试你的angular应用程序。如果你主持,那么就不会有这样的问题。
some text goes here
chrome.exe --disable-web-security --allow-file-access-from-files