mis*_*sar 5 angular2-routing angular
如果我输入的结构类似localhost:3000 /某些东西,应用程序被正确地重定向到localhost:3000/login,但如果我以localhost:3000/something/something的形式输入URL,则应用程序崩溃,因为路由器没有正确重定向.
我像这样设置路由器文件:
@NgModule({
imports: [
RouterModule.forRoot([
{ path: '', redirectTo: '/login', pathMatch: 'full' },
{ path: 'login', component: LoginComponent },
{ path: '**', component: PageNotFoundComponent },
])
],
exports: [
RouterModule
]
})
export class AppRoutingModule {}
Run Code Online (Sandbox Code Playgroud)
我在我的Angular 2应用程序中使用HTML5 URL样式.
当他输入像localhost:3000/something/something这样的URL时,如何设置用于显示用户404页面的通配符?
| 归档时间: |
|
| 查看次数: |
624 次 |
| 最近记录: |