I'm using a ngFor (in a "list-component") to display several "item-component" and I want to send the user to a "item-detail-component" when he clicks on one of these items.
Problem is I'm still an early learner on Angular and I don't understand the logic behind those routerLinks that doesnt even exists in my mind.
I tried to get the "id" of my items with let i = index, but I don't know what to do with i after this step.
Can someone help me on this problem ? Thanks a lot !
liste-actus HTML
<div class="container list-group">
<a *ngFor="let actu of actus | async; let i = index" class="list-group-item list-group-item-action flex-column align-items-start" routerLink="">
<app-item-actus [actu]="actu"></app-item-actus>
</a>
<br>
</div>
liste-actus TS
import { Component, OnInit } from '@angular/core';
import { Observable } from 'rxjs';
import { ActivatedRoute } from '@angular/router';
import { ActuService } from 'src/app/services/actu.service';
import { Actu } from 'src/app/modeles/actu';
@Component({
selector: 'app-liste-actus',
templateUrl: './liste-actus.component.html',
styleUrls: ['./liste-actus.component.css']
})
export class ListeActusComponent implements OnInit {
actus: Observable<Actu[]>;
constructor(private actuService: ActuService, private route: ActivatedRoute) {
}
ngOnInit() {
this.actus = this.actuService.getActusList();
}
}