1
I think my problem is the HTML page in my Angula project, I can’t help but point out that I’m using the Primeng lib.
See the figure below, it is perfectly loading my list;
But I still can’t load my list into the dropdown primeng
This is my HTML;
<div class="col-sm-4 col-xs-12">
<mt-input-container label="Categorias">
<p-dropdown [options]="menu.restaurantId"
name="restaurantId" placeholder="Selecione"
[(ngModel)]="menu.restaurantId"
></p-dropdown>
</mt-input-container>
</div>
The list is loaded by this method.
ngOnInit() {
this.getCategorias();
}
getCategorias() {
this.menuAdminService.categoriasMenu().subscribe(
response => {
console.log(response.menu)
if (!response.menu) {
} else {
this.menus = response.menu.map( c =>(
{ label: c.name, value: c._id }
))
}
},
error => {
console.log(<any>error);
}
);
}
=====================================UPDATING
I made this change in HTML
<div class="col-sm-4 col-xs-12">
<mt-input-container label="Categorias">
<p-dropdown [options]="menus" name="restaurantId" placeholder="Selecione"
[(ngModel)]="menus"
></p-dropdown>
</mt-input-container>
</div>
It is loading the list, just not showing as in the image below;