1

I need to custom the output of item in dropdown: My object are in this way: {'code':1001,'description':jjj}

I wourld show 1001-jjj like output so I do:

 <p-dropdown [options]="list" [(ngModel)]="element" >
                    <ng-template let-item pTemplate="selectedItem">
                        {{ item['code'] }} - {{ item['description'] }}
                    </ng-template>
                    <ng-template let-item pTemplate="item">
                        {{ item['code'] }} - {{ item['description'] }}
                    </ng-template>
                </p-dropdown>

and in my ts I do:

  @Output() element: Object;
  list: Object[];

The list is loaded currect so when print the list variable I read the correct value and it is a list of 15 element.

The problem is that when I open the dropdown I count 15 element but there isn't the text. The item is empty. Anyone can help me?

poopp
  • 1,297
  • 2
  • 13
  • 23

0 Answers0