Looking to add a click event to an anchor tag in my template:
This is how my HTML appears:
<a (click)="deleteUser(user)">
<i class="la la-trash"></i>
</a>
The user
variable comes from a previous iteration using *ngFor="let user of users"
The function deleteUser()
is defined in my users.component.ts
file:
(Component code here)
Despite trying various methods, the click event does not seem to trigger. There are no errors or responses. I've experimented with different variations as well:
- routerLink=""
- [routerLink]=""
- href=""
- href="#"
- href="#!"
- href="!#"
- Switching
<a>
tags for<div>
,<span>
,<div>
,<button>
, but none have been successful
I attempted this solution from another question, but it seems incompatible since I am using Angular 5.
The template framework I'm utilizing is Metronic (in case it's relevant)