I'm trying to get the id of the clicked anchor element. Here's my HTML:
<div class="list-group col-md-4" *ngFor="let book of bookbook">
<a href="#" class="list-group-item" id={{book.id}} (click)="selectBook($event)">
<img src="{{book.image}}" alt="#">
<p><strong>Price: ${{book.price}} | {{book.id}}</strong></p>
<p>{{book.summary}}</p>
</a>
</div>
Here's the click function:
selectBook(event){
console.log(event.target.id)
}
Any idea what I'm doing wrong here?