@Component({
selector: 'upper',
template: `<ng-content></ng-content>`
})
export class UpperComponent {
@ContentChild(SomeComponent) content: SomeComponent;
}
@Component({
selector: 'upper',
template: `<ng-content></ng-content>`
})
export class UpperComponent {
constructor(private elt:ElementRef, private renderer:Renderer) {
}
ngAfterViewInit() {
var textNode = this.elt.nativeElement.childNodes[0];
var textInput = textNode.nodeValue;
this.renderer.setText(textNode, textInput.toUpperCase());
}
}
@Component({
selector: 'upper',
template: `
<div #contentWrapper>
<ng-content></ng-content>
</div>`
})
export class UpperComponent {
@ViewChild('contentWrapper') content: ElementRef;
ngAfterViewInit() {
console.log(this.content.nativeElement);
}
}