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

Function getContext

packages/core/src/render3/util/discovery_utils.ts:84–89  ·  view source on GitHub ↗
(element: Element)

Source from the content-addressed store, hash-verified

82 * @publicApi
83 */
84export function getContext<T extends {}>(element: Element): T | null {
85 assertDomElement(element);
86 const context = getLContext(element)!;
87 const lView = context ? context.lView : null;
88 return lView === null ? null : (lView[CONTEXT] as T);
89}
90
91/**
92 * Retrieves the component instance whose view contains the DOM element.

Callers 2

contextMethod · 0.90

Calls 2

getLContextFunction · 0.90
assertDomElementFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…