这是我的父组件 html
<app-card>
<div class="body">This is body</div>
<div class="title">This is title</div>
</app-card>
这是我的 CardComponent
<div class="card">
<ng-content select=".title"></ng-content>
<ng-content select=".body"></ng-content>
</div>
所以我想访问<div class="body">This is body</div>
CardComponent 中的这个元素(),如果它是一个组件,我可以通过 ContentChild 访问它,但是如何访问它呢?
我尝试使用模板变量(在 ContentChild 中传递变量名)并尝试从 ngAfterContentInit 获取未定义的形式访问它