Skip to content

MdSlideToggle: change event is triggered before the model's value is updated #7074

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

Closed
MatthieuBarthel opened this issue Sep 14, 2017 · 2 comments · Fixed by #7076
Closed
Assignees

Comments

@MatthieuBarthel
Copy link

Bug, feature request, or proposal:

Bug (it is the only form control that acts like this and it wasn't the case on beta 8)

What is the expected behavior?

When the change event is triggered the model's value should already reflect the new value.

What is the current behavior?

When the change event is triggered, the model value is not updated and still reflects the old value.
This happens with template-driven and reactive forms.

What are the steps to reproduce?

http://plnkr.co/edit/6x5qfWWRwJFb32yr4UX4?p=preview

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

Material beta 10

@devversion devversion self-assigned this Sep 14, 2017
devversion added a commit to devversion/material2 that referenced this issue Sep 14, 2017
Whenever the value of the slide-toggle changes through interaction, a `change` event will be emitted. The value change then will be reported to the `ControlValueAccessor` which fires the `ngModelChange` output.

Right now the `ngModelChange` output fires after the normal `change` output. This should be the other way around because developers expect the two-way data binding to already reflect the change.

Fixes angular#7074
@RaphyLi
Copy link

RaphyLi commented Sep 22, 2017

You can use the formControl until the pull to be approuved and included in next update.

josephperrott pushed a commit that referenced this issue Sep 25, 2017
Whenever the value of the slide-toggle changes through interaction, a `change` event will be emitted. The value change then will be reported to the `ControlValueAccessor` which fires the `ngModelChange` output.

Right now the `ngModelChange` output fires after the normal `change` output. This should be the other way around because developers expect the two-way data binding to already reflect the change.

Fixes #7074
andrewseguin pushed a commit that referenced this issue Sep 29, 2017
#7076)

Whenever the value of the slide-toggle changes through interaction, a `change` event will be emitted. The value change then will be reported to the `ControlValueAccessor` which fires the `ngModelChange` output.

Right now the `ngModelChange` output fires after the normal `change` output. This should be the other way around because developers expect the two-way data binding to already reflect the change.

Fixes #7074
@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 7, 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

Successfully merging a pull request may close this issue.

3 participants