Skip to content

select compareWith receiving incorrect parameters #18330

@JohnYoungers

Description

@JohnYoungers

I'm submitting a...


[ ] Regression (a behavior that used to work and stopped working in a new release)
[x] Bug report  
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question

Current behavior

In a reactive form with a select, changing the options results in the compareWith function to be called incorrectly.

Expected behavior

compareWith should be called with the correct model

Minimal reproduction of the problem with instructions

  1. Go to: http://plnkr.co/edit/8vucKr2H0QGuZQJnhySi?p=preview
  2. Change dropdown value to 'A'
  3. Click 'Update List' button
  4. Value stays the same; however, it was not re-selected in the select
  5. All comparisons are logged to the console window: You can see once you've regenerated the list the comparisons go from object v. object to object v. string ("1: Object")

What is the motivation / use case for changing the behavior?

I have a form where previous inputs can impact the options of a specific select: if the user's original selection is still valid, it should show it's still selected.

Environment


Angular version: 4.3.1


Browser:
- [X] Chrome (desktop) version XX
- [ ] Chrome (Android) version XX
- [ ] Chrome (iOS) version XX
- [ ] Firefox version XX
- [ ] Safari (desktop) version XX
- [ ] Safari (iOS) version XX
- [ ] IE version XX
- [ ] Edge version XX
 

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions