我们有一个包含以下网址的应用。
http://localhost:8080/myapp/#/route1
我的路由配置如下
export const routeConfig = [
{
path: 'myapp',
children: [
{
path: 'route1',
loadChildren: 'app/route1/route1.module#Route1Module',
}
]
}];
当我尝试访问该网址时,我收到以下错误 -
Error: Cannot match any routes. URL Segment: 'myapp/'
Error: Cannot match any routes. URL Segment: 'route1'
at t.noMatchError (main.bundle.js:1)
at e.selector (main.bundle.js:1)
at e.error (polyfills.bundle.js:1)
at e._error (polyfills.bundle.js:1)
at e.error (polyfills.bundle.js:1)
在这种情况下,路由的正确配置是什么?什么应该是基础href?
答案 0 :(得分:0)
是否有路由模块在route1模块中路由route1子节点? 您的设置已经延迟加载了“mayapp / route1 / ...' URL路由到route1模块。 这意味着您应该在route1模块中处理您想要的解决方案。 如果是这样,您需要在' route1模块'。
中配置网址路由