Please take a look on this issue.
Assumptions:
The default input of primeng p-listbox is a dictionary like below:
let dict = [{
label: 'some label',
value: 'some value'
}]
I would like to use my own dictionary as "options" of primeng component
Code:
I would like to provide my custom dictionary as item using dataKey property and templates:
let dict = [{
id: 1,
name: 'name'
}]
I know how to replace "label" with templates but replacing "value" with dataKey property does not work:
<p-listbox dataKey="id" [style]="{'width':'100%'}" [options]="dict" multiple="multiple" [(ngModel)]="selected" checkbox="checkbox" filter="filter">
<template let-item pTemplate="item">
{{item.name}}
</template>
</p-listbox>
Regards