Angular 角度2访问视图
当我试图转到时,我得到一个404错误。我可以通过将usehash设置为true并在url中使用hash标记来实现这一点。但是,我不能这样做,因为我试图在运行时传递查询字符串参数,而哈希标记会弄乱这一点。是否有一种方法可以在应用程序加载期间使用以下url而不使用哈希 网址: 路线:Angular 角度2访问视图,angular,Angular,当我试图转到时,我得到一个404错误。我可以通过将usehash设置为true并在url中使用hash标记来实现这一点。但是,我不能这样做,因为我试图在运行时传递查询字符串参数,而哈希标记会弄乱这一点。是否有一种方法可以在应用程序加载期间使用以下url而不使用哈希 网址: 路线: 当您将深度链接与PathLocationStrategy一起使用时,浏览器会在您输入时尝试在服务器上定位名为unmanaged的资源。服务器上没有这样的资源,因此您得到的是404。您需要在服务器上配置重定向,使其将未
当您将深度链接与PathLocationStrategy一起使用时,浏览器会在您输入时尝试在服务器上定位名为unmanaged的资源。服务器上没有这样的资源,因此您得到的是404。您需要在服务器上配置重定向,使其将未知资源重定向到应用程序的index.html。然后Angular Router将解析您的URL并转到正确的视图。阅读服务器关于配置重定向的文档 通过URL中的散列,浏览器只知道散列之后的内容是用于客户端导航,而不会命中服务器
const routes: Routes = [
{
path: '',
component: StartPage
},
{
path: 'unmanaged/:controllerId/:activeGroupId',
component: UnmanagedPage
},
{
path: 'edge',
component: EdgeComponent,
canActivate: [AuthGuard],
children: [
{ path: '', component: DevicesPage, pathMatch: 'full' },
{ path: 'devices', component: DevicesPage },
{ path: 'device/:id', component: DeviceDetailsPage },
{ path: 'device-edit/:id', component: DeviceEditPage},
{ path: 'device-add', component: DeviceAddPage },
{ path: 'groups', component: GroupsPage },
{ path: 'cyber-score', component: CyberScorePage },
{ path: 'profile', component: ProfilePage },
{ path: 'profile-edit', component: ProfileEditPage }
]
},
{
path: 'guest',
component: GuestComponent,
children: [
{ path: 'device', component: GuestDeviceDetailsPage }
]
},
{
path: '**',
component: PageNotFoundPage
}
];