Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(mat-input): matInput with type number fires twice changeValue event inside formGroup #9620

Closed
gogakoreli opened this issue Jan 26, 2018 · 4 comments
Assignees

Comments

@gogakoreli
Copy link

Bug, feature request, or proposal:

Bug

What is the expected behavior?

matInput with type="number" shouldn't fire valueChanges event twice, when inside ReactiveForm

What is the current behavior?

matInput with type="number" fires valueChanges event twice, when inside ReactiveForm

What are the steps to reproduce?

https://stackblitz.com/edit/type-number-input-2-value-changes-fired

What is the use-case or motivation for changing an existing behavior?

Event shouldn't fire twice it is extra and bad performance wise

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

5.2.2

Is there anything else we should know?

Open console inside developer tools and look at console when changing value of Age inside my StackBlitz example. You can see that when you change value of age event is fired once and then when you move your focus on other component it fires second same event again.

@julianobrasil
Copy link
Contributor

It seems that angular (not material) is just forwarding the standard html behavior: emitting a change event on keydown and when the element loses focus.

@gogakoreli
Copy link
Author

I thought same but I don't understand why doesn't same happen on other input elements?

@mmalerba
Copy link
Contributor

Here is the same example with all Angular Material stuff removed as proof that it is not a Material issue: https://stackblitz.com/edit/type-number-input-2-value-changes-fired-o6m19b?file=main.ts

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants