TypeError: Cannot read property 'split' of undefined at defaultUrlMatcher

 javascript - Angular2 v3 component router: TypeError: Cannot read property 'split' of undefined - Stack Overflow


I figured out what was going on. In case anyone else hits a similar issue, the problem in this case was in WorkspaceRoutes.

export const WorkspaceRoutes: RouterConfig = [
  {path: 'workspace/:id', component: WorkspaceRootComponent},
  {children: [    // this should not be the start of a new object
    {path: 'projects', component: WorkspaceDashboardComponent},
    {path: 'newproject', component: ProjectNewComponent},
    {path: '', redirectTo: 'projects', terminal: true},
  ]}
];

Should be

export const WorkspaceRoutes: RouterConfig = [
  {path: 'workspace/:id', 
  component: WorkspaceRootComponent,
  children: [
    {path: 'projects', component: WorkspaceDashboardComponent},
    {path: 'newproject', component: ProjectNewComponent},
    {path: '', redirectTo: 'projects', terminal: true},
  ]}
];

The children item of WorkspaceRootComponent was not under that item, but on the same level.

Không có nhận xét nào:

Is it okay to use both fetchpriority="high" and loading="eager" in img tag?

 https://stackoverflow.com/questions/77744344/is-it-okay-to-use-both-fetchpriority-high-and-loading-eager-in-img-tag Yes Fetchpriority and l...