文章内容

2020/5/31 16:32:38,作 者: 黄兵

Angular 404路由问题

最近再接触到Angular,顺便谢谢项目。

再项目中可能有些页面找不到,需要报404错误,再Angular路由中如何配置404页面呢?

新的路由器可以更好地处理'**'路径规范中缺失的路由。

下面是示例代码:

const routes: Routes = [
{path: '', redirectTo: 'home', pathMatch: 'full'},
{path: 'home', component: HomeComponent},
{path: '**', component: NotFoundComponent}
];


参考资料:

1、Handling 404 with Angular2


分享到:

发表评论

评论列表