fix(autocomplete): fix autocomplete with objects containing value pro… - #1417
Open
bschnabel wants to merge 1 commit into
Open
fix(autocomplete): fix autocomplete with objects containing value pro…#1417bschnabel wants to merge 1 commit into
bschnabel wants to merge 1 commit into
Conversation
…perty fix issue primefaces/primeng#17469 "Autocomplete doesn't work as expected when working with Objects if the Object contains key named value"
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fix issue primefaces/primeng#17469 "Autocomplete doesn't work as expected when working with Objects if the Object contains key named value"
Description
When suggestions contanis a list of objects and the objects contained a property named
value. i.e.[{display:'one', value: 1}, {display: 'two', value: 2}], selecting the first value would result in the ngmodel containing only1, instead of{display:'one', value: 1}. Changing value to let's saycodeputs the object into the ngModel after selecting an option.This behaviour is fixed by this PR.
NOTE: If you WANT to only have the value in the ngModel this still works by providing the attribute
optionValue="value"in the html template to the p-autocomplete element.Related issues
primefaces/primeng#17469 (for some reason i do not understand this issue did not get migrated to the new repo)
Fixes #
Type of change
Breaking only in case of extreme edge case. Not sure weather to put breaking change or none breaking change. this behaviour used to be working in older versions of primeng.
Breaking changes
if you actually only want the value property inside the ngmodel provide
optionValue="value"like you would have to do for any other object-property other thanvalue.None
Test plan
manual testing plus
pnpm run test:unitChecklist