相关疑难解决方法(0)

angular 2包括html模板

在角度2我需要创建一个带有冗余部分的大型html模板.因此,我想创建多个html模板,并将它们包含在主html文件中(如angular1中的ng-include)

但是如何在主模板中包含子模板?

例:

<!-- test.html -->

<div>
    this is my Sub-Item
    <!-- include sub1.html here-->
</div>
<div>
    this is second Sub-Item
    <!-- include sub2.html here-->
</div>
Run Code Online (Sandbox Code Playgroud)

-

<!-- sub1.html -->
<div>
    <button>I'am sub1</button>
</div>
Run Code Online (Sandbox Code Playgroud)

-

<!-- sub2.html -->
<div>
    <div>I'am sub2</div>
</div>
Run Code Online (Sandbox Code Playgroud)

html angular

20
推荐指数
1
解决办法
3万
查看次数

标签 统计

angular ×1

html ×1