【发布时间】:2017-02-04 10:45:14
【问题描述】:
我无法使用延迟加载模块让我的“404 页面”正常工作。当我在浏览器中输入一个随机网址时,我只看到一个空白页面,而不是我很酷的 404 页面。
这是我的路由配置
export const routes: Routes = [
{ path: '', redirectTo: 'dashboard', pathMatch: 'full'},
{ path: 'dashboard', loadChildren: 'app/dashboard/dashboard.module#DashboardModule'},
{ path: 'buckets', loadChildren: 'app/buckets/buckets.module#BucketsModule'},
{ path: '**', loadChildren: 'app/notfound/notfound.module#NotFoundModule'}
];
export const routing: ModuleWithProviders = RouterModule.forRoot(routes);
当我浏览 /buckets 时,我看到块正在延迟加载,它显示了在 Buckets 模块中配置的适当组件,没关系。
但它不适用于 404 错误页面。通常,路径的 '**' 应该适用于所有其他不存在的路由,但它不起作用。
有人可以帮忙吗?
-angular2 final (2.0.0)
【问题讨论】:
标签: angular routing http-status-code-404