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

Method remove

packages/core/src/linker/view_container_ref.ts:616–630  ·  view source on GitHub ↗
(index?: number)

Source from the content-addressed store, hash-verified

614 }
615
616 override remove(index?: number): void {
617 const adjustedIdx = this._adjustIndex(index, -1);
618 const detachedView = detachView(this._lContainer, adjustedIdx);
619
620 if (detachedView) {
621 // Before destroying the view, remove it from the container's array of `ViewRef`s.
622 // This ensures the view container length is updated before calling
623 // `destroyLView`, which could recursively call view container methods that
624 // rely on an accurate container length.
625 // (e.g. a method on this view container being called by a child directive's OnDestroy
626 // lifecycle hook)
627 removeFromArray(getOrCreateViewRefs(this._lContainer), adjustedIdx);
628 destroyLView(detachedView[TVIEW], detachedView);
629 }
630 }
631
632 override detach(index?: number): ViewRef | null {
633 const adjustedIdx = this._adjustIndex(index, -1);

Callers 1

clearMethod · 0.95

Calls 5

_adjustIndexMethod · 0.95
detachViewFunction · 0.90
removeFromArrayFunction · 0.90
destroyLViewFunction · 0.90
getOrCreateViewRefsFunction · 0.85

Tested by

no test coverage detected