MCPcopy Index your code
hub / github.com/angular/angular / appendChild

Function appendChild

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

Source from the content-addressed store, hash-verified

638 * @param childTNode The TNode of the child element
639 */
640export function appendChild(
641 tView: TView,
642 lView: LView,
643 childRNode: RNode | RNode[],
644 childTNode: TNode,
645): void {
646 const parentRNode = getParentRElement(tView, childTNode, lView);
647 const renderer = lView[RENDERER];
648 const parentTNode: TNode = childTNode.parent || lView[T_HOST]!;
649 const anchorNode = getInsertInFrontOfRNode(parentTNode, childTNode, lView);
650 if (parentRNode != null) {
651 if (Array.isArray(childRNode)) {
652 for (let i = 0; i < childRNode.length; i++) {
653 nativeAppendOrInsertBefore(renderer, parentRNode, childRNode[i], anchorNode, false);
654 }
655 } else {
656 nativeAppendOrInsertBefore(renderer, parentRNode, childRNode, anchorNode, false);
657 }
658 }
659
660 _processI18nInsertBefore !== undefined &&
661 _processI18nInsertBefore(renderer, childTNode, lView, childRNode, parentRNode);
662}
663
664/**
665 * Returns the first native node for a given LView, starting from the provided TNode.

Callers 3

ɵɵtextFunction · 0.90
elementLikeStartSharedFunction · 0.90
templateCreateFunction · 0.90

Calls 4

getParentRElementFunction · 0.85
getInsertInFrontOfRNodeFunction · 0.85
isArrayMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…