如何解决使用useHash在电子/角度中进行布线:是吗?
我正在Electron内构建一个Angular应用程序..但是我在路由到我的页面时遇到了问题-有很多问题,但是对我没有用
main.js
win.loadURL(url.format({
pathname: path.join(__dirname,'dist/application/index.html'),protocol: 'file:',slashes: true,hash: 'overview'
}));
app-routing.module.ts:
const routes: Routes = [
{path: "",component: OverviewComponent,},{path: "overview",{path: "account",component: AccountComponent},{path: "commerce",component: CommerceComponent},{path: "billing",component: BillingComponent},{ path: '**',redirectTo: '/overview',pathMatch: 'full' }
];
@NgModule({
imports: [RouterModule.forRoot(routes,{useHash: true})],exports: [RouterModule]
})
没有“ hash#”标签,一切正常,但是我希望我的应用程序可以从其他途径启动,但是当我尝试时。.
我得到:
错误错误:未捕获(承诺):错误:无法匹配任何路由。网址段:“ index.html” 错误:无法匹配任何路线。网址段:“ index.html”
我也尝试过
<base href="./">
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。