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

158
Vistas
How to print the array of elements in Angular 12 and Typescript?

I am not able to display the array of elements values in html page.

I have selected values of json array of object, from this result I removed the duplicate category values, and that values convered to array of string. and I listed that array of element. But I don't know to display the forEach element in a ngFor loop in angular.

export class PreviewComponent implements OnInit {
public menus : any = [];
newuniq: any[][];

ngOnInit() {
 this.newmenuService.getProducts()
    .subscribe(resp=>{
      this.menus = resp;
    console.log("cart",this.menus)
    })
 const newuniq = [...new Set(this.menus.map(item => item.category
      ))];

 newuniq.forEach(function(element) {
      console.log("element",element);
      
    });

}

component.html {{newuniq}}

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

0

<div *ngFor="let item of newuniq">
{{item.category}}
</div>

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