I want to append new child node after the parent node but appendChild appends it inside of it. Here is what I have:
My component.html:
<div id="parent" (click)="appendChild()">
parent node
</div>
My 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)
}
This inserts new div that was created inside of parent node like this:


just insert it in elements parent