Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

293
Views
De JSON anidado a tabla con rango de filas Angular

Traté de hacer una tabla con mi JSON anidado obtenido de una API. No sé cómo fusionar dinámicamente mis celdas cuando sea necesario sabiendo que mi JSON se puede anidar hasta 6 o 7 veces.

Lo que quiero :
mesa que quiero
mesa que quiero

Lo que obtuve :
mesa que tengo
mesa que tengo

Mi archivo TS:

 questionnaire = [ { title : "theme1", children : [{ title : "theme2", children : [ { title : "theme3", children : [] }, { title : "theme4", children : [] }, ] }] }, { title : "theme5", children : [ { title : "theme6", children : [] }, { title : "theme7", children : [] }, ] }, ]

Mi componente.html:

 <ng-container *ngFor="let periode of questionnaire"> <br> <table> <tr> <td>{{ periode.title }}</td> <td *ngFor="let theme of periode.children"> {{ theme.title }} </td> </tr> </table> </ng-container>
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Generar sus tablas a través de una función recursiva y luego configurar el HTML resultante a través de [innerHTML] sería una buena decisión.

La función recursiva necesitaría no solo devolver su parte HTML correspondiente de la tabla, sino también cuántas filas contiene. De esa manera, puede utilizar el atributo de rowspan de fila siempre que haya niños.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!