Praveen Balanagendra
Praveen Balanagendra

Reputation: 53

Electron + Angular Application + Error: Uncaught (in promise): Error: Cannot match any routes. URL Segment:

I have the angular + electron app with the below structure

enter image description here

Routes in the Angular App looks like this, with the lazy load for the wrapper modules

const routes: Routes = [
  {path: 'lib', loadChildren: () => import('./wrapper/wrapper.module').then(m => m.WrapperModule)},
  {path: 'home', loadChildren: () => import('./wrapper/homewrapper.module').then(m => m.HomewrapperModule)},
  {path: '', component: HomeComponent},
];

The code works perfectly well when launched as a Angular application in browser localhost:4200. However, it doesn't work if it launched as Electron app. The HomeComponent, which is the default route comes up perfectly fine in Electron BrowserWindow. However the following URLs doesn't work with lib URL

Without hash

Not allowed to load local resource: file:///D:/Technical/ElectronJS/Demo2/electron-demo/dist/electron-demo/index.html/lib

With hash

ERROR Error: Uncaught (in promise): Error: Cannot match any routes. URL Segment: 'index.html' core.js:4061 file:///D:\Technical\ElectronJS\Demo2\electron-demo\dist\electron-demo\index.html#\lib

What am I doing wrong here?

Upvotes: 1

Views: 629

Answers (1)

Praveen Balanagendra
Praveen Balanagendra

Reputation: 53

Got the solution. If someone is looking for the answer, the solution mentioned in this post solved the problem: https://stackoverflow.com/a/62010347/4951812

Upvotes: 2

Related Questions