Routing in Electron/Angular with useHash: true?

Viewed 220

I am building an Angular App inside Electron.. but I have a problem with routing to my pages - there are many questions but nothing worked for me

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", component: OverviewComponent,},
  {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]
})

without the "hash#" tag everything works fine but I want my app to be started at a different route, but when I try..

I get:

ERROR Error: Uncaught (in promise): Error: Cannot match any routes. URL Segment: 'index.html' Error: Cannot match any routes. URL Segment: 'index.html'

I also tried the

<base href="./">
0 Answers
Related