-
Notifications
You must be signed in to change notification settings - Fork 26.5k
Closed
Labels
Description
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
- Go to: http://plnkr.co/edit/8vucKr2H0QGuZQJnhySi?p=preview
- Change dropdown value to 'A'
- Click 'Update List' button
- Value stays the same; however, it was not re-selected in the select
- 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