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

Function assertStandalone

packages/router/src/utils/config.ts:73–86  ·  view source on GitHub ↗
(fullPath: string, component: Type<unknown> | undefined)

Source from the content-addressed store, hash-verified

71}
72
73export function assertStandalone(fullPath: string, component: Type<unknown> | undefined): void {
74 if (component && isNgModule(component)) {
75 throw new RuntimeError(
76 RuntimeErrorCode.INVALID_ROUTE_CONFIG,
77 `Invalid configuration of route '${fullPath}'. You are using 'loadComponent' with a module, ` +
78 `but it must be used with standalone components. Use 'loadChildren' instead.`,
79 );
80 } else if (component && !isStandalone(component)) {
81 throw new RuntimeError(
82 RuntimeErrorCode.INVALID_ROUTE_CONFIG,
83 `Invalid configuration of route '${fullPath}'. The component must be standalone.`,
84 );
85 }
86}
87
88function validateNode(route: Route, fullPath: string, requireStandaloneComponents: boolean): void {
89 if (typeof ngDevMode === 'undefined' || ngDevMode) {

Callers 2

loadComponentMethod · 0.90
validateNodeFunction · 0.85

Calls 2

isStandaloneFunction · 0.90
isNgModuleFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…