Skip to content

Inside a ngFor loop, MdCheckbox 'change' event is not emitted when 'checked' binding change. #507

@tomsdev

Description

@tomsdev

Bug, feature request, or proposal:

Bug

What is the expected behavior?

MdCheckbox 'change' event is always emitted when 'checked' binding change.

What is the current behavior?

It works for a standalone MdCheckbox but not when MdCheckbox is inside a ngFor loop.

What are the steps to reproduce?

I created a small plunkr with standalone checkboxes and checkboxes inside ngFor loop:
http://plnkr.co/edit/v2Nv4QcMVPVwdX32z3hQ

Steps:
Open the devtools console to see console.log messages.
Check (e.g. click) the "Select all" checkbox.
All the checkboxes become selected.
In the devtools console you see:

onSelectAllCheckboxChange
onCheckboxChange
onCheckboxChange

Instead of what you'd expect:

onSelectAllCheckboxChange
onCheckboxChange
onCheckboxChange
onNgForCheckboxChange
onNgForCheckboxChange

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

Latest version (see the plunkr), tested on Goobuntu with Chrome.

Is there anything else we should know?

This bug could be an Angular 2 bug and not a MdCheckbox bug. Feel free to move it to Angular 2 issues if relevant.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions