![](/img/trans.png)
[英]Angular Unit Test: Uncaught Error: Uncaught (in promise): Error: Cannot match any routes. URL Segment: 'logout'
[英]Electron + Angular Application + Error: Uncaught (in promise): Error: Cannot match any routes. URL Segment:
我有具有以下结构的 angular + electron 应用程序
Angular 应用程序中的路由看起来像这样,包装模块的延迟加载
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}, ];
当在浏览器 localhost:4200 中作为 Angular 应用程序启动时,该代码运行良好。 但是,如果它作为 Electron 应用程序启动,它将不起作用。 作为默认路由的 HomeComponent 在 Electron BrowserWindow 中非常好。 但是,以下 URL 不适用于 lib URL
不带 hash
不允许加载本地资源:file:///D:/Technical/ElectronJS/Demo2/electron-demo/dist/electron-demo/index.html/lib
与 hash
ERROR 错误:未捕获(在承诺中):错误:无法匹配任何路由。 URL 段:'index.html' core.js:4061 file:///D:\Technical\ElectronJS\Demo2\electron-demo\dist\electron-demo\index.html#\lib
我在这里做错了什么?
得到了解决方案。 如果有人正在寻找答案,这篇文章中提到的解决方案解决了这个问题: https://stackoverflow.com/a/62010347/4951812
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.