ng-content和@ContentChild的配合用法 已注销 2021-04-26 125 阅读1分钟 ng-conent提供了@ContentChild和@ContentChildren来获取ng-conent里面包含的组件(类似@ViewChild和@ViewChildren). 一个例子: app-content-section节点里,包含了所有待选择的子节点: app-content-section的内部布局: 使用注解@ContentChild, 传入子节点id,拿到ChildComponent: 更多Jerry的原创文章,尽在:“汪子熙”: