Skip to content

Error while activating a path from a component #31688

@HKOPQ

Description

@HKOPQ

Command

serve

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

No response

Description

My main app component :

**_


home

_**

My "app-routing-modules.ts" file :

_**import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { RouteTest } from './components/route-test/route-test';

export const routes: Routes =
[{ path : 'home', component :RouteTest },
children : [
{path :'childPath1', component :Component1 ,outlet: 'outlet_1'
} ,
{path :'childPath2', component :Component2 ,outlet: 'outlet_1'
}
];

@NgModule({
imports: [RouterModule.forRoot(routes)],
exports: [RouterModule]
})
export class AppRoutingModule { }**_

My RouteTest component :

**_import { Component } from '@angular/core';
import { AppRoutingModule } from "../../app-routing-module";

@component({
selector: 'app-route-test',
standalone: true,
templateUrl: './route-test.html',
styleUrl: './route-test.css',
imports: [AppRoutingModule]
})
export class RouteTest {

}_**

The related template ("route-test.html") :

**_

route-test does not work!

_**

The Problem : the "home" link appears correctly at the launch of application . As I click "home" the RouteTest component is not rendered and the following error appears on the browser's console :

ERROR TypeError: Cannot read properties of undefined (reading 'ɵcmp')
at getComponentDef (root_effect_scheduler.mjs:1515:12)
at extractDirectiveDef (debug_node.mjs:15278:12)
at debug_node.mjs:15491:32
at createTView (debug_node.mjs:6915:63)
at getOrCreateComponentTView (debug_node.mjs:6953:29)
at createComponentLView (debug_node.mjs:6992:19)
at instantiateAllDirectives (debug_node.mjs:8324:9)
at createDirectivesInstances (debug_node.mjs:8105:5)
at ComponentFactory2.create (debug_node.mjs:13661:17)
at ViewContainerRef2.createComponent (debug_node.mjs:14044:47)

Minimal Reproduction

ng serve

Exception or Error

ERROR TypeError: Cannot read properties of undefined (reading 'ɵcmp')
    at getComponentDef (root_effect_scheduler.mjs:1515:12)
    at extractDirectiveDef (debug_node.mjs:15278:12)
    at debug_node.mjs:15491:32
    at createTView (debug_node.mjs:6915:63)
    at getOrCreateComponentTView (debug_node.mjs:6953:29)
    at createComponentLView (debug_node.mjs:6992:19)
    at instantiateAllDirectives (debug_node.mjs:8324:9)
    at createDirectivesInstances (debug_node.mjs:8105:5)
    at ComponentFactory2.create (debug_node.mjs:13661:17)
    at ViewContainerRef2.createComponent (debug_node.mjs:14044:47)

Your Environment

Package                      Version
------------------------------------
@angular-devkit/architect    0.2003.4
@angular-devkit/core         20.3.4
@angular-devkit/schematics   20.3.4
@angular/build               20.3.4
@angular/cdk                 20.2.8
@angular/cli                 20.3.4
@angular/material            20.2.8
@schematics/angular          20.3.4
rxjs                         7.8.2
typescript                   5.9.3
zone.js                      0.15.1

Operating System is Windows 11 Home  version 25H2

Anything else relevant?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions