繁体   English   中英

(Angular 2+) ng-content 投影而不渲染选择器容器

[英](Angular 2+) ng-content projection without rendering the selector container

<ng-content>可以按以下方式使用吗?

定义:

<th>title</th>
<ng-content select="[stuff]"></ng-content>

使用:

<div stuff>
    <th>category</th>
</div>

生成的 HTML 不包含<div stuff>

<th>title</th>
<th>category</th>

这可以使用 ng-container 来实现

<ng-container stuff>替换<div stuff> <ng-container stuff>应该可以工作

示例https://stackblitz.com/edit/angular-hhimgu

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM