I am trying to build a listing component in Angular2 that takes the items, the columns and the templates for the fields of the items from the user of the component. So I am
you can do it without ngOutletContext. You have to use ng-template instead of template. following code works for me:
app.component.html:
app-parent is a child of app-component. app-child is declared in app-component as template and this template is used in app-parent.
app.parent.html:
app.parent.ts:
@Component({
selector: 'app-parent',
templateUrl: './parent.component.html',
styleUrls: ['./parent.component.css']
})
export class ParentComponent implements OnInit {
@Input() public templateChild1: TemplateRef;
public ngOnInit() {
}
}