MdCheckBox is behaving different to native checkbox
Bug, feature request, or proposal: Bug
Links for both native and MdCheckBox version below
What is the expected behavior?
Native Checkbox version http://plnkr.co/edit/cZbFWOlCeZuj7YdUczPm?p=preview
What is the current behavior?
This is with MdCheckBox http://plnkr.co/edit/FFpqdNhQfvbUynbPE1ZD?p=preview
What are the steps to reproduce?
- Click on the top select all check box for 'Write'
- Now click (reset) Write for one of the resource
Native version has the desired behaviour that is, unselect the top most checkbox if one of the below one is unchecked. But with MdCheckBox the change to reset top most checkbox triggers on change event, which is resetting all the below checkboxes.
I don't know which one is correct behaviour or both are correct.
Any help to get the MdCheckBox version working is appreciated.
What is the use-case or motivation for changing an existing behavior?
Get MdCheckBox behave as close to native checkbox as possible
Which versions of Angular, Material, OS, browsers are affected?
alpha 5
Is there anything else we should know?
Bo
Interesting also, check this out
http://plnkr.co/edit/nDWK7EmmCBgMkHIKRIg7?p=preview
the checkbox click function is called twice, why so?
@sendilkumarn I have experienced the double fires since the last release (alpha 5).
@jelbourn is this correct, I will submit a PR if so
Add a method for click event in checkbox. we can re use the checkbox change method itself. This kinda solves problem.
It seems that the issue here isn't a double-firing change, but is instead caused by different behavior between native inputs and our checkbox for when change events should be fired. Native inputs only fire a change event when they have user focus. The MdCheckbox fires a change event whenever it changes for any reason. I've actually had a note written about this to discuss with the rest of the team for a couple weeks now.
Yeah agree to that. But clicks firing two times is also an issue. Check #613
Aim is to prevent double firing of click event
one more weird behavior with respect to checkbox. Is this even correct or am I missing out anything.
click / change one - just printing ng model value => returns true / false click / change two - just printing ng model value => returns MDCheckboxChange Object
is this expected?
I've set up a simple plunkr to demonstrate the duplicate events by logging to the console - http://embed.plnkr.co/3IGFLbFEpvVldtOOosAq/
On first click one change and two click events are fired. On subsequent clicks two change and two click events are fired.
I'm having to set 10ms timeouts on all material inputs before reading model values from them - it would be great if they could update in the current digest cycle, but I presume the delays are there to avoid change after checked warnings.
I also have this issue where I'm getting an erroneous (changed) event to fire when the [ngModel] causes the checkbox to change from checked to unchecked. This behavior does not happen for md-input.
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.