ngAfterViewInit () :ボイド{
// DOMロードされたライフサイクル機能、DOMここで取得
聞かせてDOM2 :任意の=のドキュメントを。getElementByIdを('DOM2' )
コンソール。ログ(DOM2 )
DOM2 。スタイル。色= 「青」
}
<divの#myDom > 家の家の家</ div>
@ ViewChild ('MYDOM' 、ヌル)MYDOM :任意の
ngOnInit (){
console.log(this.myDom, "00000")
this.myDom.nativeElement.style.width= '100px'
this.myDom.nativeElement.style.height= '100px'
this.myDom.nativeElement.style.backgroundColor= 'pink'