( hostTNode: TElementNode | TContainerNode | TElementContainerNode, hostLView: LView, )
| 690 | * @returns The ViewContainerRef instance to use |
| 691 | */ |
| 692 | export function createContainerRef( |
| 693 | hostTNode: TElementNode | TContainerNode | TElementContainerNode, |
| 694 | hostLView: LView, |
| 695 | ): ViewContainerRef { |
| 696 | ngDevMode && assertTNodeType(hostTNode, TNodeType.AnyContainer | TNodeType.AnyRNode); |
| 697 | |
| 698 | let lContainer: LContainer; |
| 699 | const slotValue = hostLView[hostTNode.index]; |
| 700 | if (isLContainer(slotValue)) { |
| 701 | // If the host is a container, we don't need to create a new LContainer |
| 702 | lContainer = slotValue; |
| 703 | } else { |
| 704 | // An LContainer anchor can not be `null`, but we set it here temporarily |
| 705 | // and update to the actual value later in this function (see |
| 706 | // `_locateOrCreateAnchorNode`). |
| 707 | lContainer = createLContainer(slotValue, hostLView, null!, hostTNode); |
| 708 | hostLView[hostTNode.index] = lContainer; |
| 709 | addToEndOfViewTree(hostLView, lContainer); |
| 710 | } |
| 711 | _locateOrCreateAnchorNode(lContainer, hostLView, hostTNode, slotValue); |
| 712 | |
| 713 | return new R3ViewContainerRef(lContainer, hostTNode, hostLView); |
| 714 | } |
| 715 | |
| 716 | /** |
| 717 | * Creates and inserts a comment node that acts as an anchor for a view container. |
no test coverage detected