Angular+PrimeNG+Sakai 骨架项目:重新路由 sakai 演示

问题描述 投票:0回答:2

我从这里克隆了 Sakai 角骨架:

git clone https://github.com/primefaces/sakai-ng.git

默认情况下,“登陆”URL 指向 Sakai 演示。 我希望我的基本 URL 指向我的应用程序,同时保留 Sakai 的演示作为参考(至少在开发阶段)。 为此,我想将整个 sakai 演示重新路由到“sakai”路由,这样:

  • myUrl/#/sakai”带我进入 Sakai 仪表板,
  • MyUrl/#/sakai/uikit/formlayout”带我到特定的“UIKit/Form” 布局演示,
  • 每个 Sakai 演示页面等...

所以在我的 app-routing.module.ts 中,我做了:

RouterModule.forRoot([
    // My Application
    //{ path: '', component: HomeComponent },

    // Sakai
    {
        path: 'sakai', component: AppLayoutComponent,
        children: [
            { path: '', loadChildren: () => import('./sakai/components/dashboard/dashboard.module').then(m => m.DashboardModule) },
            { path: 'uikit', loadChildren: () => import('./sakai/components/uikit/uikit.module').then(m => m.UikitModule) },
            { path: 'utilities', loadChildren: () => import('./sakai/components/utilities/utilities.module').then(m => m.UtilitiesModule) },
            { path: 'documentation', loadChildren: () => import('./sakai/components/documentation/documentation.module').then(m => m.DocumentationModule) },
            { path: 'blocks', loadChildren: () => import('./sakai/components/primeblocks/primeblocks.module').then(m => m.PrimeBlocksModule) },
            { path: 'pages', loadChildren: () => import('./sakai/components/pages/pages.module').then(m => m.PagesModule) },
        ],
    },
    // code continues...

但是这样做无法与演示的左侧菜单正常工作,因为它继续使用旧的链接路线:

MyUrl/#/uikit/formlayout
代替 :
MyUrl/#/sakai/uikit/formlayout

我尝试在 Sakai 组件自己的路由模块中进行修改,但没有成功。

谁能告诉我如何实现这一目标?

angular routes sakai
2个回答
0
投票

您必须调整仪表板中的路由器链接

src/app/layout/app.menu.component.ts

0
投票

您只需在 app.module 中注释掉提供商的 LocationStrategy 和 hashLocationStrategy 部分即可

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.