BrowserAnimationsModule changes the behaviour of select-dropdowns
See original GitHub issueI’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
It is rather complicated to sum up the situation, here is my SO-Posting on the matter: https://stackoverflow.com/questions/45420803/browseranimationsmodule-altering-behaviour-of-select-dropdowns
Basically, when I programmatically remove an option form a dropdown, I dont want the selection to change. In case the select-dropdown is pristine, removing an option will cause the select to display the first option as the selected one: Here is the defective plunkr: https://plnkr.co/edit/ayzM2HNtO6Hkkr8jkgVA?p=preview
Expected behavior
I dont think the selection of a pristine select should change, when an option is removed programmatically. Here is a working plunkr: https://plnkr.co/edit/dPDpEQm14pWlFNfLe4nP?p=preview
Now the thin is, the only difference between defective and working plunkr is that in the working plunkr I have remove the BrowserAnimationsModule from the Module-Imports (at the bottom of the file, I did keep the ts-import )
This makes it seem that the BrowserAnimaitonsModule is somehow responsible for changing the behaviour of the select-dropdown.
Minimal reproduction of the problem with instructions
What is the motivation / use case for changing the behavior?
Environment
Angular version: 4.3.2
Browser:
- [x ] Chrome (desktop) version XX
- [ ] Chrome (Android) version XX
- [ ] Chrome (iOS) version XX
- [ x] Firefox version XX
- [ ] Safari (desktop) version XX
- [ ] Safari (iOS) version XX
- [ ] IE version XX
- [ ] Edge version XX
For Tooling issues:
- Node version: XX
- Platform:
Others:
Issue Analytics
- State:
- Created 6 years ago
- Reactions:4
- Comments:9 (4 by maintainers)
The value doesn’t flip as the model stays empty. It only displays an element as selected where none are. Here is another defective example : https://stackblitz.com/edit/angular-pjrg1p
A simple workaround is to add
animations: [ trigger('',[])]
to your components.This is still an problem in the latest Angular 9 release candidate with Ivy enabled. Fortunately I found that my patch in pull request #23784 will fix this issue if it is merged.