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

Function verifyNotAnOrphanComponent

packages/core/src/render3/component_ref.ts:108–123  ·  view source on GitHub ↗
(componentDef: ComponentDef<unknown>)

Source from the content-addressed store, hash-verified

106}
107
108function verifyNotAnOrphanComponent(componentDef: ComponentDef<unknown>) {
109 // TODO(pk): create assert that verifies ngDevMode
110 if (
111 (typeof ngJitMode === 'undefined' || ngJitMode) &&
112 componentDef.debugInfo?.forbidOrphanRendering
113 ) {
114 if (depsTracker.isOrphanComponent(componentDef.type as Type<any>)) {
115 throw new RuntimeError(
116 RuntimeErrorCode.RUNTIME_DEPS_ORPHAN_COMPONENT,
117 `Orphan component found! Trying to render the component ${debugStringifyTypeForError(
118 componentDef.type,
119 )} without first loading the NgModule that declares it. It is recommended to make this component standalone in order to avoid this error. If this is not possible now, import the component's NgModule in the appropriate NgModule, or the standalone component in which you are trying to render this component. If this is a lazy import, load the NgModule lazily as well and use its module injector.`,
120 );
121 }
122 }
123}
124
125function createRootViewInjector(
126 componentDef: ComponentDef<unknown>,

Callers 1

createMethod · 0.85

Calls 2

isOrphanComponentMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…