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

Emitting event on model change #776

Closed
aminebizid opened this issue Jun 28, 2016 · 3 comments
Closed

Emitting event on model change #776

aminebizid opened this issue Jun 28, 2016 · 3 comments

Comments

@aminebizid
Copy link

This is just for discussion.
Do components have to emit changes if the viewmodel changes.
As example
<md-checkbox [(ngModel)]="myValue">
If i check (using the mouse) the checkbox, it's normal to get an event emitted with the value of the change.
But if I fo progamatically do this.myValue = true; Do the checkbox have to emit an event?

@fringd
Copy link

fringd commented Jun 29, 2016

+1 this is causing a bug for my when I attempt to implement hierarchical checkboxes.

checking all of the boxes causes the parent box to become checked, all good.

but unchecking a single box cases the parent box to become unchecked, which fires an event, which causes all of the boxes to become unchecked. not good, and also causes a devmode value changed after change detection exception.

@jelbourn
Copy link
Member

@fringd should be fixed in checkbox in the latest release. The fix needs to make its way to other components. The gist is that controls should only fire a change event when they have focus. Closing this into #791

@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 5, 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