【发布时间】:2018-01-23 07:25:22
【问题描述】:
当我以 Angular 执行路由时,出现类似 Error: Cannot match any routes. URL Segment: 'example2/child1'here 的错误,我在 app.module.ts 中定义路由
{ path:"for", component: ForComponent },
{ path:"example1", component: Example1Component },
{ path:"example2",component: Example2Component ,
children: [
{ path:"child1",component:Child1Component },
{ path:"child2",component:Child2Component },
{ path:"child3",component:Child3Component }
]
}
在我的父组件中,我设置了动态链接来导航子组件
<ul>
<li *ngFor="let item of coutry">
<a href="" routerLink="{{item.name}}" >{{item.name}}</a>
</li>
</ul>
那我该怎么办?另外,在 StackOverflow 中看到同样的问题,但没用click here
【问题讨论】:
标签: angular routing angular-routing