Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

181
Vistas
Embedding dynamic variable in ngFor in Angular 11

I'm getting a syntax error when I write this code...

<tbody>
   <tr *ngFor="let incident of incidents | paginate: { itemsPerPage: itemsPerPage, currentPage: page }">
    <td>{{ incident.name }}</td>
    <td>{{ incident.type }}</td>
    <td>{{ incident.str }}</td>
    <td>{{ incident.mtdna }}</td>
    <td>{{ incident.ystr }}</td>
    <td>{{ incident.xstr }}</td>
    <td>{{ incident.snps }}</td>
    <td>
      <button type="submit" (click)="editRecord({{incident.id}})" class="btn btn-primary float-start">
      Edit {{ incident.id }}
      </button>
    </td>
   </tr>
</tbody>

The issue is the (click)="editRecord({{incident.id}})" part of this code.

Angular 11 is not allowing me to embed the id into the editRecord() method call.

If I write (click)="editRecord(1), then the error goes away.

My question is, how do I embed the id into the editRecord method call?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

There is no need for {{ }}, you can just avoid that becase (click)="expects variable or method calls or executable code"

<button type="submit" (click)="editRecord(incident.id)" class="btn btn-primary float-start">
      Edit {{ incident.id }}
      </button>
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda