Angular路由加载错误组件
Angular routing load wrong component
我有这个路由文件:
{
path: '',pathMatch:'full', loadChildren: () => import('./component/login/login.module').then(m =>
m.LoginModule)
},
{
path: 'section2', loadChildren: () => import('./componenti/section2/section2.module').then(m =>
m.Section2)
},
当我继续http://localhost:4200/
我看到了登录组件,它工作正常,但是当我输入正确的参数时,我做了:
this.router.navigate(['/section2']);
但是当我在 /section do 上执行时,它会显示登录组件
谁能帮帮我?
如果你能提供一个 stackblitz,我们可以更好地调试它
看上面的代码我发现有一个拼写错误
./componenti
而不是
/section2 的组件
我有这个路由文件:
{
path: '',pathMatch:'full', loadChildren: () => import('./component/login/login.module').then(m =>
m.LoginModule)
},
{
path: 'section2', loadChildren: () => import('./componenti/section2/section2.module').then(m =>
m.Section2)
},
当我继续http://localhost:4200/
我看到了登录组件,它工作正常,但是当我输入正确的参数时,我做了:
this.router.navigate(['/section2']);
但是当我在 /section do 上执行时,它会显示登录组件 谁能帮帮我?
如果你能提供一个 stackblitz,我们可以更好地调试它
看上面的代码我发现有一个拼写错误
./componenti
而不是
/section2 的组件