How can I access the \"content\" of a component from within the component class itself?
I would like to do something like this:
<
If you want to get a reference to a component of the transcluded content, you can use:
@Component({
selector: 'upper',
template: ` `
})
export class UpperComponent {
@ContentChild(SomeComponent) content: SomeComponent;
}
If you wrap then you can access access to the transcluded content like
@Component({
selector: 'upper',
template: `
`
})
export class UpperComponent {
@ViewChild('contentWrapper') content: ElementRef;
ngAfterViewInit() {
console.debug(this.content.nativeElement);
}
}