PrimeNG dropdown does not load

0

I think my problem is in the HTML page in my Angula project, I can not stress that I'm using the PrimeNG lib.

See the figure below, it is loading perfectly my list;

ButIstillcannotloadmylistintothePrimeNGdropdowncomponent

ThisismyHTML;

<divclass="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);
      }
    );
  }

=================================== UPDATE

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's loading the list, just not showing as in the image below;

    
asked by anonymous 21.08.2018 / 19:43

1 answer

1

It looks like you forgot the optionLabel:

<p-dropdown [options]="menus" name="restaurantId"
    optionLabel="name" placeholder="Selecione" [(ngModel)]="menus"
  ></p-dropdown>
    
22.08.2018 / 09:34