Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/templates/2.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/templates/2.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
Templates angular2将模板嵌入index.html_Templates_Angular_Browser Cache - Fatal编程技术网

Templates angular2将模板嵌入index.html

Templates angular2将模板嵌入index.html,templates,angular,browser-cache,Templates,Angular,Browser Cache,这是一种使用类似angular 1在index.html文件中嵌入模板的功能的方法: <script type="text/ng-template" id="app/klasses/klass-detail/klass-detail.component.html"> your template here </script> 你的模板在这里 我要求它的原因是浏览器缓存静态文件(*.html)的问题,如果浏览器未关闭缓存,则无法获取对模板的潜在更新-我不能依赖它-还

这是一种使用类似angular 1在index.html文件中嵌入模板的功能的方法:

<script type="text/ng-template" id="app/klasses/klass-detail/klass-detail.component.html">
  your template here
</script>

你的模板在这里

我要求它的原因是浏览器缓存静态文件(*.html)的问题,如果浏览器未关闭缓存,则无法获取对模板的潜在更新-我不能依赖它-还将限制请求数…

Angular2的
@组件
具有
templateUrl
属性。你看过吗?或者使用“模板”属性的内联模板我知道templateUrl和内联模板-问题是关于在脚本标记中嵌入模板…Angular不支持脚本标记中的模板。您可以使用类似这样的方法动态创建组件,将模板作为字符串传递,但这是一种黑客行为。Angular2的
@Component
s具有
templateUrl
属性。你看过吗?或者使用“模板”属性的内联模板我知道templateUrl和内联模板-问题是关于在脚本标记中嵌入模板…Angular不支持脚本标记中的模板。您可以使用类似的方法动态创建组件,在其中以字符串形式传递模板,但这是一种黑客行为。