question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

BrowserAnimationsModule changes the behaviour of select-dropdowns

See original GitHub issue

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

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:open
  • Created 6 years ago
  • Reactions:4
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

7reactions
YounesMcommented, Dec 21, 2017

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.

@Component({
  animations: [trigger('', [])],
  selector: 'my-app',
  templateUrl: 'app.component.html',
  styleUrls: ['app.component.scss']
})
1reaction
theodorejbcommented, Nov 12, 2019

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Select dropdown displays element that is not selected
So, after migrating my hole project from Angular 2 > Angular 5, I noticed a weird behavior on the select . I have...
Read more >
BrowserAnimationsModule - Angular
Object used to configure the behavior of the BrowserAnimationsModule . Returns. ModuleWithProviders<BrowserAnimationsModule>. Usage Noteslink. When registering ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found