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

Method remove

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

Source from the content-addressed store, hash-verified

591 }
592
593 override remove(index?: number): void {
594 const adjustedIdx = this._adjustIndex(index, -1);
595 const detachedView = detachView(this._lContainer, adjustedIdx);
596
597 if (detachedView) {
598 // Before destroying the view, remove it from the container's array of `ViewRef`s.
599 // This ensures the view container length is updated before calling
600 // `destroyLView`, which could recursively call view container methods that
601 // rely on an accurate container length.
602 // (e.g. a method on this view container being called by a child directive's OnDestroy
603 // lifecycle hook)
604 removeFromArray(getOrCreateViewRefs(this._lContainer), adjustedIdx);
605 destroyLView(detachedView[TVIEW], detachedView);
606 }
607 }
608
609 override detach(index?: number): ViewRef | null {
610 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