primeng
primeng copied to clipboard
Multi Select Custom Templete Undefined Selected Object
Entity {
name:
image;
}
sources: Entity[];
entities Entity[];
<p-multiSelect *ngIf="showImage" [options]="sources" [(ngModel)]="entities" (onChange)="select($event);" (ngModelChange)="entitiesChange.emit($event)" styleClass="form-control" [panelStyle]="{maxWidth:'1em'}">
<ng-template let-source pTemplate="source">
<img [src]="source.image" style="width:24px;display:inline-block;vertical-align:middle"/>
<div style="font-size:14px;float:right;margin-top:4px">{{source.name}}</div>
</ng-template>
</p-multiSelect>
Display is okay. But when select any item in component, selected item pusing undefined to entities. I change sources: Entity[] to sources: SelectItem[] its works. Sorry if this is not issue. Custom object work well without templete. With templete custom object doesnt work. I need to fill SelextItem array with my object. It would be nice if it worked custom object directly.
I'm unable to replicate with the latest PrimeNG. If the issue still persists wit|h the new version please create a new issue with our stackblitz template.