我想设置为我的应用程序页面导航的路线,但得到以下错误:错误
ERROR in C:/my-app/src/app/router.component.ts (9,2): Type '({ Path: string; redirectTo: string; PathMatch: string; } | { Path: string; component: typeof Abo...' is not assignable to type 'Route[]'. Type '{ Path: string; redirectTo: string; PathMatch: string; } | { Path: string; component: typeof Abou...' is not assignable to type 'Route'.
代码:
export const router: Routes=[
{Path:'', redirectTo:'about', PathMatch:'full'},
{Path:'about', component:AboutComponent},
{Path:'products', component:ProductsComponent},
];
看这里的文档︰https://angular.io/api/router/Routes路径属性应该是小写? – robjam
如果有任何答案对您有所帮助,您能否接受或者赞扬它?谢谢。 –
谢谢你的帮助,我纠正了我的代码,并得到了预期的结果。这篇文章节省了我的时间。非常感谢你 –