在我的Angular 2应用(RC4)中,当index.html打开时,我收到错误错误:无法匹配任何路线:''我知道以前曾有人问过这个问题,但这些情况下的答案似乎都不适用于我.也就是说,我已经在尽力建议解决此问题.我有
In my Angular 2 app (RC4), when the index.html opens, I get the error Error: Cannot match any routes: '' I know this has been asked before, but none of the answers in those cases seems to apply to me; that is, I"m already doing everything recommended to fix this. I have
<base href="/">在我的头部元素中(也尝试过
in my head element (also tried
<base href=".">完全没有区别).我的app.route.ts中包含以下内容:
which makes no difference at all). I have the following in my app.route.ts:
export const routes: RouterConfig = [ { path: '', redirectTo: '/instruction-steps', pathMatch: 'full'}, { path: 'settings', component: SettingsComponent }, { path: 'find-and-replace', component: FindAndReplaceComponent }, { path: 'instruction-steps', component: InstructionStepsComponent } ];该页面确实可以正确呈现,并且我到其他视图的路线也可行.但是,如果我重新加载页面,不仅会得到错误,而且页面不会呈现.
The page does render correctly, and my routes to the other views work. If I reload the page, however, I'll not only get the error, but the page does not render.
这是在lite服务器而不是ASP.NET上运行的.
This is running on lite-server, not ASP.NET.
推荐答案以下是一些注意事项:
请注意,这是从Angular 2的最终版本开始的.
Please note that this is as of the Final release of Angular 2.
更多推荐
Angular 2收到“错误:无法匹配任何路线:"
发布评论