md-checkbox don't honor the [value] binding
See original GitHub issueBug, feature request, or proposal:
md-checkbox don’t honor the [value]
binding.
What is the expected behavior?
https://material.angular.io/components/component/checkbox mentions an @Input value
property that can be set as the value for this input.
What is the current behavior?
It only uses boolean values, it does not use whatever the user specifies in [value]
.
What are the steps to reproduce?
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
What is the use-case or motivation for changing an existing behavior?
When trying to implement a checkbox-list control I want to have an array with the values that are represented by the checkboxes.
Which versions of Angular, Material, OS, TypeScript, browsers are affected?
Angular material: 2.0.0-beta.6 Angular: 4.1.1
Is there anything else we should know?
Issue Analytics
- State:
- Created 6 years ago
- Reactions:2
- Comments:10 (6 by maintainers)
Top Results From Across the Web
Checkbox not binding to scope in angularjs - Stack Overflow
The best practice is to never bind directly to a variable on the scope in an ng-model , this is also known as...
Read more >Directives > mdCheckbox - AngularJS Material
Assignable angular expression to data-bind to. ... If a truthy expression or no value is passed in the checkbox renders in the md-indeterminate...
Read more >Falcon Sandbox v8.30 © Hybrid Analysis
Submit malware for free analysis with Falcon Sandbox and Hybrid Analysis technology. Hybrid Analysis develops and licenses analysis tools to fight malware.
Read more >Untitled
M1 southbound roadworks, Gamestop 60458, Barcelona wash basin, Price of ek mukhi rudraksha ... Future looking for her, Md-checkbox value, Ragtime 2016 tour!...
Read more >Selection Controls - KivyMD's documentation - Read the Docs
MDCheckbox : on_active: app.on_checkbox_active(*args). def on_checkbox_active(self, checkbox, value): if value: print('The checkbox', checkbox, 'is active', ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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 valuebar
, not booltrue
.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.