ng-conent提供了@ContentChild和@ContentChildren来获取ng-conent里面包含的组件(类似@ViewChild和@ViewChildren).
一个例子:
app-content-section节点里,包含了所有待选择的子节点:
app-content-section的内部布局:
使用注解@ContentChild, 传入子节点id,拿到ChildComponent:
本文分享自 作者个人站点/博客 前往查看
如有侵权,请联系 cloudcommunity@tencent.com 删除。
本文参与 腾讯云自媒体分享计划 ,欢迎热爱写作的你一起参与!