MCPcopy Create free account
hub / github.com/angular/angular / appendChild

Function appendChild

packages/core/src/render3/node_manipulation.ts:670–692  ·  view source on GitHub ↗
(
  tView: TView,
  lView: LView,
  childRNode: RNode | RNode[],
  childTNode: TNode,
)

Source from the content-addressed store, hash-verified

668 * @param childTNode The TNode of the child element
669 */
670export function appendChild(
671 tView: TView,
672 lView: LView,
673 childRNode: RNode | RNode[],
674 childTNode: TNode,
675): void {
676 const parentRNode = getParentRElement(tView, childTNode, lView);
677 const renderer = lView[RENDERER];
678 const parentTNode: TNode = childTNode.parent || lView[T_HOST]!;
679 const anchorNode = getInsertInFrontOfRNode(parentTNode, childTNode, lView);
680 if (parentRNode != null) {
681 if (Array.isArray(childRNode)) {
682 for (let i = 0; i < childRNode.length; i++) {
683 nativeAppendOrInsertBefore(renderer, parentRNode, childRNode[i], anchorNode, false);
684 }
685 } else {
686 nativeAppendOrInsertBefore(renderer, parentRNode, childRNode, anchorNode, false);
687 }
688 }
689
690 _processI18nInsertBefore !== undefined &&
691 _processI18nInsertBefore(renderer, childTNode, lView, childRNode, parentRNode);
692}
693
694/**
695 * Returns the first native node for a given LView, starting from the provided TNode.

Callers 4

ɵɵtextFunction · 0.90
elementLikeStartSharedFunction · 0.90
ɵɵforeignComponentFunction · 0.90
templateCreateFunction · 0.90

Calls 4

getParentRElementFunction · 0.85
getInsertInFrontOfRNodeFunction · 0.85
isArrayMethod · 0.80

Tested by

no test coverage detected