【发布时间】:2017-06-16 09:11:18
【问题描述】:
我有一些问题。 让我解释一下
这是我的html代码
<div class="alert alert-danger alert-dismissable" *ngIf="errorMessage">
<a href="#" class="close" data-dismiss="alert" aria-label="close">×</a>
<strong>{{ errorMessage }}</strong>
</div>
<h3 class="page-header">All Unread Report</h3>
<table class="table table-hover">
<thead>
<tr>
<th>NIK</th>
<th>Nama</th>
<th>Topik</th>
<th>Detail</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let item of allcomplaint;let i= index">
<td>{{i+1}}</td>
<td>{{item.sendername}}</td>
<td>{{item.topic}}</td>
<td>
<a class="btn btn-success" routerLink="/edit/{{item.id}}">Edit</a>
</td>
</tr>
</tbody>
</table>
我想要的是,如果我单击该编辑按钮链接,它将导航到其他组件。但我总是在下面遇到这样的错误
未捕获(承诺中):错误:无法匹配任何路由。网址段: 'edit/1' 错误:无法匹配任何路由。 URL 段:'edit/1
这是我的路线配置
{ path: 'dashboard_pool', component: DashboardPoolComponent,
children:[
{ path: 'unread', component: PoolUnreadReportComponent,
children:[
{path:'detail/:id', component:PoolComplaintDetailComponent}
]
},
如何解决这个问题?谢谢:)
【问题讨论】:
-
你能显示
edit的路由配置吗?? -
你的意思是我的路由配置吗?这是我的问题。还是您的意思是编辑链接的组件? @SameerK
-
我猜你正在尝试的 URL 是
dashboard_pool/unread/edit/1,但在unread的children下,我在你的问题中看不到edit的路由配置,只有detail存在。可能是因为你得到了错误.. -
对不起,先生。那是我的错。对不起先生。感谢那。你是最好的。对不起我的坏@SameerK
-
请不要抱歉 :-)
标签: angular