Javascript 脚本中的角度外部模板
使用模板时,我们可能会将应用程序托管在Web服务器上,否则会导致跨源错误。因此,我将模板放在脚本标记中,如下所示: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并
<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