我正在使用 routerLink 为博客组件传递 ID,它给了我错误 - 无法匹配任何路由。URL 段:'blog/%5B'../blogdetails',%20blogs.post_id%5D'
constructor(private http:HttpClient,private route: ActivatedRoute) {
this.route.params.subscribe( params => console.log(params) );
}
<p><a routerLink="['../blogdetails', blogs.post_id]" href="#">{{blogs.post_title}}</a> </p>
{ path: 'blogdetails/:id', component: BlogdetailsComponent , canActivate: [AuthGuard]},