after
新しい子ノードを親ノードに追加したいのですが、appendChild
それを追加しinside
ます。ここに私が持っているものがあります:
私のcomponent.html
:
<div id="parent" (click)="appendChild()">
parent node
</div>
私のcomponent.ts
:
private appendChild() {
const div = this.renderer.createElement('div');
const text = this.renderer.createText('child node')
this.renderer.appendChild(div, text);
this.renderer.appendChild(document.getElementById("parent"), div)
}
これは、次のようにノードdiv
内で作成されたnew を挿入します。parent