[英]Component's tag after <router-outlet>
partial1.html partial1.html
<div class="content">test test</div>
main.html main.html中
<div class="main">
<router-outlet></router-outlet>
</div>
Let say from main.html
, route to call partial1.html
. 让我们说从
main.html
,路由到partial1.html
。 And when runtime, the html will be like this: 而在运行时,html将如下所示:
<div class="main">
<router-outlet></router-outlet>
<partial1>
<div class="content">test test</div>
</partial>
</div>
Is there any way I can remove the extra tag? 有什么办法可以删除多余的标签? maybe merge tag, if possible.
可能的话,合并标签。 without break the Angular router.
不中断Angular路由器。
Also, I don't want to break the CSS. 另外,我不想破坏CSS。 This is important.
这个很重要。
.main > .content {}
I got my own solution. 我有自己的解决方案。
partial1.html partial1.html
<div class="content">test test</div>
main.html main.html中
<router-outlet></router-outlet>
@Component({
selector: ".main", //instead of 'partial1'
templateUrl: "./partial1.html",
encapsulation: ViewEncapsulation.None,
})
I got the results needed. 我得到了需要的结果。
<router-outlet></router-outlet>
<div class="main">
<div class="content">test test</div>
</div>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.