【发布时间】:2018-03-06 02:07:37
【问题描述】:
我想在按下 list-profile html 文档中提供的链接后发送一个变量。当前代码不起作用并且崩溃。如果需要,我可以提供更多详细信息。
list-profile.component.html
<div class="col col-sm-4 col-sm-offset-4">
<ul id="list_of_users">
<li class="list-group-item list-group-item-action" *ngFor="let user of users"><a [routerLink]="['/profile', user.id]" routerLinkActive="active" (click)="testFunc(user.id)">{{user.name}}</a></li>
</ul>
</div>
app.module.ts
const appRoutes: Routes = [
{ path: 'addProfile', component: AddProfileComponent },
{ path: 'listProfiles', component: ListProfilesComponent},
{ path: 'profile:id', component: ProfileComponent}
];
【问题讨论】:
标签: html angular parameters routing components