( hostTNode: TElementNode | TContainerNode | TElementContainerNode, hostLView: LView, )
| 667 | * @returns The ViewContainerRef instance to use |
| 668 | */ |
| 669 | export function createContainerRef( |
| 670 | hostTNode: TElementNode | TContainerNode | TElementContainerNode, |
| 671 | hostLView: LView, |
| 672 | ): ViewContainerRef { |
| 673 | ngDevMode && assertTNodeType(hostTNode, TNodeType.AnyContainer | TNodeType.AnyRNode); |
| 674 | |
| 675 | let lContainer: LContainer; |
| 676 | const slotValue = hostLView[hostTNode.index]; |
| 677 | if (isLContainer(slotValue)) { |
| 678 | // If the host is a container, we don't need to create a new LContainer |
| 679 | lContainer = slotValue; |
| 680 | } else { |
| 681 | // An LContainer anchor can not be `null`, but we set it here temporarily |
| 682 | // and update to the actual value later in this function (see |
| 683 | // `_locateOrCreateAnchorNode`). |
| 684 | lContainer = createLContainer(slotValue, hostLView, null!, hostTNode); |
| 685 | hostLView[hostTNode.index] = lContainer; |
| 686 | addToEndOfViewTree(hostLView, lContainer); |
| 687 | } |
| 688 | _locateOrCreateAnchorNode(lContainer, hostLView, hostTNode, slotValue); |
| 689 | |
| 690 | return new R3ViewContainerRef(lContainer, hostTNode, hostLView); |
| 691 | } |
| 692 | |
| 693 | /** |
| 694 | * Creates and inserts a comment node that acts as an anchor for a view container. |
no test coverage detected