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

98
Views
cómo hacer un bucle dentro de la matriz de objetos Angular

Quiero mostrar valores de mi json pero no sé cómo hacerlo. ¿Es posible hacer un bucle dentro de una matriz de objetos? No sé si la tubería de valor clave puede ayudarme, pero quiero prescindir de ella.

¿Cómo obtener el estudiante2 y también el nombre para mostrarlo?

gracias a todos.

json

 { "student": { "student1": [], "student2": [ { "id": "123", "name": "boot" }, "student3": [], ] }, "teacher": { "teacher1": [], "teacher2": [ { "id": "123456", "name": "toto" }, ] } }

ts.archivo

 get(){ this.service.getAll().subscribe((data:any) => { object.keys(data).length > 0; }) }
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Suponiendo que su objeto JSON de su solicitud GET se parece al que publicó anteriormente, simplemente haga lo siguiente:

 get(){ this.service.getAll().subscribe((data:any) => { data.student.forEach(element => { for (let key in element) { console.log(" key:", key, "value:", element[key]); for (let val in element[key]) { console.log(" value:", val); } } }); }) }
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!