角路径,查询和哈希路由相结合

时间:2019-04-01 08:49:09

标签: angular angular-router

我希望我的应用具有这样的URL
https://example.com/rootFolder/child/other?page=1&sort=-name#lightbox/{fileID}**

我已经尝试过该路由器,但似乎无法匹配任何哈希部分。

const routes: Routes = [
    {
        path: '',
        redirectTo: 'root',
        pathMatch: 'full',
    },
    {
        path: '#/lightbox/:fileID',
        component: LightBoxComponent,
        outlet: 'light-box',
    },
    {
        matcher: lightBoxMatcher,
        component: LightBoxComponent,
        outlet: 'light-box',
    },
    {
        matcher: folderMatcher, // Matches any depth of folders
        component: MainComponent,
    },
];

@NgModule({
    imports: [
        RouterModule.forRoot(routes, {
            onSameUrlNavigation: 'reload',
            scrollPositionRestoration: 'enabled',
            paramsInheritanceStrategy: 'always',
            //enableTracing: true,
        }),
    ],
    ...
});

0 个答案:

没有答案