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}}