Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass the option as a template variable in Select Components without wrapping to SelectItem #9505

Closed
cagataycivici opened this issue Nov 9, 2020 · 1 comment
Assignees
Labels
Type: Breaking Change Issue contains a breaking change related to a specific component
Milestone

Comments

@cagataycivici
Copy link
Member

Due to 4295, we no longer wrap custom option objects as SelectItems so template variables no longer need to be SelectItems, this will introduce a breaking change because custom objects are now the variable themselves instead of getting accessed with the value property.

Before

<p-dropdown [options]="options" [(ngModel)]="modelValue">
    <ng-template let-option pTemplate="item">
          {{option.value.propName}}
    </ng-template>
</p-dropdown>

After

<p-dropdown [options]="options" [(ngModel)]="modelValue">
    <ng-template let-option pTemplate="item">
          {{option.propName}}
    </ng-template>
</p-dropdown>
@cagataycivici cagataycivici added the Type: Breaking Change Issue contains a breaking change related to a specific component label Nov 9, 2020
@cagataycivici cagataycivici added this to the 10.1.0 milestone Nov 9, 2020
@cagataycivici cagataycivici self-assigned this Nov 9, 2020
@aznarepse
Copy link

I migrated my app from 10 to 11 and hit this rock.
To change all the templates to access the property without using 'value' in between should not be a drama.

However, in version 10, the selection was the whole object and, when bound to a reactive form, the forms control would get the whole object. Now, I am getting only a property of the object.
My objects have a property named 'value' and this one is being taken by default. I am aware I can set what property is used with optionValue, but I need the whole object.

This is breaking all the interface with the remote API when posting the DTO objects.

Is there a quick way to store the object in the selection instead of a property only?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Breaking Change Issue contains a breaking change related to a specific component
Projects
None yet
Development

No branches or pull requests

2 participants