md-checkbox don't honor the [value] binding.
https://material.angular.io/components/component/checkbox mentions an @Input value property that can be set as the value for this input.
It only uses boolean values, it does not use whatever the user specifies in [value].
http://plnkr.co/edit/4ryXsamVJlcMaDHJsEgu?p=preview
Providing a Plunker (or similar) is the best way to get the team to see your issue.
Plunker template: https://goo.gl/DlHd6U
When trying to implement a checkbox-list control I want to have an array with the values that are represented by the checkboxes.
Angular material: 2.0.0-beta.6
Angular: 4.1.1
@lobo-tuerto you can get the value in the (change) event, ie. (change)="doSomething($event.source.value)"
See this http://plnkr.co/edit/uEcocFj4q7EUUxebjQff?p=preview
@macjohnny Thanks for the useful example.
So do you think it's currently behaving as expected or should it be different?
@lobo-tuerto I think this is currently behaving as expected. It is the behavior of ngModel, and not related to material / md-checkbox, since the input binding for the value exists.
Maybe the confusion (or frustration) comes from the fact that the component has two different conteptual things that look similar at a first glance: it's state (true/false) and it's value. The state is what's (correctly) passed to ngModel.
But this aproach is not so useful when you have a list of checkboxes to check (in this case, @macjohnny 's example plunker is a good way to handle it).
Take a look at this issue: #4926. Someone is asking for implementation of a MdCheckboxGroup feature. If it gets implemented, it'll possibly work like MdRadioGroup, binding the value property of the selected checkboxes to ngModel of the MdCheckboxGroup.
I think this is a bug, not a feature. if you submit a HTML form with <input type="checkbox" name="foo" value="bar"> the parameter foo will have the str value bar, not bool true.
I agree with masterfloda, I'm trying to set a value in a reactive form on a mat-checkbox element via the [value]="some angular variable" attribute. All I get out of the form is true or null. I would expect to get the specified value or null since that's what a regular checkbox would give me.