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

Function verifyNotAnOrphanComponent

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

Source from the content-addressed store, hash-verified

107}
108
109function verifyNotAnOrphanComponent(componentDef: ComponentDef<unknown>) {
110 // TODO(pk): create assert that verifies ngDevMode
111 if (
112 (typeof ngJitMode === 'undefined' || ngJitMode) &&
113 componentDef.debugInfo?.forbidOrphanRendering
114 ) {
115 if (depsTracker.isOrphanComponent(componentDef.type as Type<any>)) {
116 throw new RuntimeError(
117 RuntimeErrorCode.RUNTIME_DEPS_ORPHAN_COMPONENT,
118 `Orphan component found! Trying to render the component ${debugStringifyTypeForError(
119 componentDef.type,
120 )} 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.`,
121 );
122 }
123 }
124}
125
126function createRootViewInjector(
127 componentDef: ComponentDef<unknown>,

Callers 1

createMethod · 0.85

Calls 2

isOrphanComponentMethod · 0.65

Tested by

no test coverage detected