Estoy tratando de obtener datos de la tabla html en angular.
componente.html:
<div class="col-lg-6"> <table style="width: 90%;"> <tr> <th style=" border-left-color: white; border-top-color: white; " ></th> <th class="t1">Name</th> <th class="t1">Issue Date</th> <th class="t1">Expiry Date</th> <th class="t1">Add License</th> </tr> <tr *ngFor="let licence of licencesImages"> <!-- Licence Image --> <td> <img [src]="licence.path" style="max-width: 30px" /> </td> <!-- Licence Name --> <td>{{ getLicenceVehicleType(licence.name) }}</td> <!-- Licence Issue Date --> <td> {{ getLicenceDate(licence.issued_date) }} </td> <!-- Licence Due Date --> <td>{{ getLicenceDate(licence.due_date) }}</td> <!-- Add Licence --> <td> <i class="fa fa-plus-circle cursor-pointer" aria-hidden="true" style="color: green" (click)="onAddLicense(output)" ></i> </td> </tr> </table> </div>en componente.ts:
onAddLicense(output) { console.log(output) }mi caso es diferente de mat-table, en cada fila tengo un botón relacionado con esta fila.
¿Cómo puedo obtener datos de esta fila al hacer clic en el botón?
intento reemplazar la salida por $event.target.value pero no funciona.
@op en lugar de hacer como:
<i class="fa fa-plus-circle cursor-pointer" aria-hidden="true" style="color: green" (click)="onAddLicense(output)" ></i>hazlo como:
<i class="fa fa-plus-circle cursor-pointer" aria-hidden="true" style="color: green" (click)="onAddLicense(licence)" ></i>