本文整理汇总了TypeScript中@angular/core.Renderer2.removeChild方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Renderer2.removeChild方法的具体用法?TypeScript Renderer2.removeChild怎么用?TypeScript Renderer2.removeChild使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@angular/core.Renderer2
的用法示例。
在下文中一共展示了Renderer2.removeChild方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: it
it('should not error when removing a child with a different parent than given', () => {
const savedParent = document.createElement('div');
const realParent = document.createElement('div');
const child = document.createElement('div');
realParent.appendChild(child);
renderer.removeChild(savedParent, child);
});
示例2: _clearSVGElement
protected _clearSVGElement(): void {
const el: HTMLElement = this._elementRef.nativeElement;
const children = el.childNodes;
const length = children.length;
for (let i = length - 1; i >= 0; i--) {
const child = children[ i ] as HTMLElement;
if (child.tagName.toLowerCase() === 'svg') {
this._renderer.removeChild(el, child);
}
}
}
示例3: replaceDynamicContent
public static replaceDynamicContent(renderer: Renderer2, dynamicWrapperEl: Element): Element[] {
if (!dynamicWrapperEl.children.length) {
return null;
}
const els = [];
for (const dEl of Array.from(dynamicWrapperEl.children)) {
renderer.insertBefore(dynamicWrapperEl.parentElement, dEl, dynamicWrapperEl);
els.push(dEl);
}
renderer.removeChild(dynamicWrapperEl.parentElement, dynamicWrapperEl);
return els;
}
示例4: removeRipple
removeRipple() {
this.renderer.removeChild(this.rippleContainer, this.rippleContainer.firstChild);
}