How does angular output subcomponents in a component template (to get subcomponent objects)

problem description

I now need to control how the child component is displayed. I have obtained the object instance of the child component component, but how do I display this object in the template of the parent component?

the environmental background of the problems and what methods you have tried

< ng-template [ngComponentOutlet] = "child [0]" > < / ng-template > this must not be done

related codes

import { Component, OnInit, ViewContainerRef, TemplateRef, ContentChildren, AfterViewInit } from "@angular/core";
import { ISelectItem } from "./item-interface";
@Component({
  selector: "zzj-table-tool-select",
  templateUrl: "./table-tool-select.component.html",
  styleUrls: ["./table-tool-select.component.scss"]
})
export class TableToolSelectComponent implements OnInit,AfterViewInit {
  children: ISelectItem[] = [];
  @ContentChildren("child") child;
  constructor() { }

  ngOnInit() {
  }
  public addItem(item: ISelectItem) {
    this.children.push(item);
  }
  ngAfterViewInit() {
    console.log("--------");
    console.log(this.child)
  }
}

Syntax Sugar:


ng-content<br><br>

@ContentChildren('child') child;

but there is no corresponding code in the template? In this way, the instance

cannot be obtained.
Menu