[button-toggle-group] bound to NgModel throws error if multiple selection is used
See original GitHub issueBug, feature request, or proposal:
Bug
What is the expected behavior?
When <button-toggle-group multiple [(ngModel)]="property">
is used, the model property should be updated with a list (object or array) of values selected in the toggle group.
Alternatively, improve the docs with a note that the ngModel
binding is not supported in multiple selection mode.
What is the current behavior?
The app crashes with error: No value accessor for form control
. The same code works when group is in exclusive selection mode
What are the steps to reproduce?
See this plunker. The app will not run unless you remove the multiple
attribute from the toggle group in /app/app.component
What is the use-case or motivation for changing an existing behavior?
It’s a bug
Which versions of Angular, Material, OS, browsers are affected?
Angular 2 rc.5
, Material 2 alpha 7-2
Issue Analytics
- State:
- Created 7 years ago
- Reactions:5
- Comments:13 (7 by maintainers)
Top Results From Across the Web
Angular Material dynamic button toggle group form control ...
That gets rid of the error, but takes away the ability to select multiple items. According to the documentation, select multiple is supported....
Read more >Angular Material Button Toggle - YouTube
The Angular Material Button Toggle can be used to show the user clearly an option they have selected with the toggle. Please LIKE...
Read more >components: src/material/button-toggle/button-toggle.ts - Fossies
4 * 5 * Use of this source code is governed by an MIT-style license that can be ... 133 * Now `ngModel`...
Read more >Split The Toggle Buttons Into Multiple Rows - ADocLib
[button-toggle-group] bound to NgModel throws error if multiple selection is used #1039 Which versions of Angular, Material, OS, browsers are affected?
Read more >UNPKG - @angular/material
n * Now `ngModel` binding is not supported in multiple selection mode. ... }\n\n /** Whether multiple button toggle group is disabled.
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
This seems to be intentionally while looking at the source.
I think it would be probably good to support
ngModel
formultiple
mode as well, and emit an array of the selectedmd-button-toggle
’s to the ngModel.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.