multiselect chips with custom label chips

Discussão em 'Angular' iniciado por MAY, Dezembro 6, 2024.

  1. MAY

    MAY Guest

    <p-multiSelect
    [options]="employees"
    [(ngModel)]="selectedEmployees[question.id]"
    [optionValue]="'nip'"
    [optionLabel]="'label'"
    display="chip"
    [placeholder]="'Select Employees'"
    [filter]="true"
    [emptyFilterMessage]="'No options found'"
    [style]="{ width: '20vw' }"
    >
    </p-multiSelect>


    this is my multiselect primeng with data like below

    this.employees = this.questions.output_schema.employee.map(
    (employee: Employee) => ({
    nip: employee.nip,
    name: employee.name,
    label: `${employee.nip} - ${employee.name}`, // this is custom label
    })
    );


    in the multiselect dropdown, the label shows as 'NIP - NAME' but in the chips, i want to only show the name is there any way i could achieve this?

    Continue reading...

Compartilhe esta Página