我是 Angular 4 世界的新手,当我想路由到 /moviegroup/:id 时遇到了这个错误。出于某种原因,我无法让它工作
应用程序.routes.ts
import { Routes, RouterModule, PreloadAllModules } from '@angular/router';
import { MovieComponent } from '.é/movie/movie.component';
import { WizardComponent } from './wizard/wizard.component';
const routes: Routes = [
{ path: '', redirectTo: 'home', pathMatch: 'full' },
{ path: 'wizard', component: WizardComponent, pathMatch: 'full' },
{
path: 'moviegroup',
children: [
{ path: 'moviegroup/:id', component: MovieComponent, pathMatch: 'full' }
]
}
];
export const routing = RouterModule.forRoot(routes, { preloadingStrategy:
PreloadAllModules });
我可以导航到http://localhost/wizard、http://localhost/moviegroup但不能导航到 http ://localhost/moviegroup/ecf84479-c23c-1702-8440-b252591364ec。我收到以下错误:
ERROR Error: Uncaught (in promise): Error: Cannot match any routes. URL Segment: 'moviegroup/ecf84479-c23c-1702-8440-b252591364ec'
Error: Cannot match any routes. URL Segment: 'moviegroup/ecf84479-c23c-1702-8440-b252591364ec'
知道我做错了什么吗?如果需要更多信息,请告诉我!
谢谢, 雷吉