问题描述
我想将新的子节点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
节点内部创建的新parent
,如下所示:
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)