In the table(table) i have loaded objects from API. When i click on “osavotjad” link i am redirected to another component where i want to load data from selected object. How can i pass id of object what is on the same line with a clicked link.
JavaScript
x
12
12
1
<div class="card-body fixed-content">
2
<div *ngIf="futureEvents">
3
<ul>
4
<li *ngFor="let event of futureEvents">
5
<span class="name">{{event.eventName}}</span>
6
<span class="name">{{event.place}}</span>
7
<span class="date">{{event.eventDate | date:'dd.MM.yyyy'}}</span>
8
<span><a routerLink="/participants">Osavoitjad</a></span>
9
<span (click)="delete(event.id)"><img src="assets/remove.svg" class="deleteBtn"></span>
10
</li>
11
</ul>
12
</div>
Advertisement
Answer
There are many ways to do that. The easiest solution will be using the router param or query params.
[routerLink]=”[participants, event.id]” (this is using parameter)
Or you can use query param in similar way.