question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[button-toggle-group] bound to NgModel throws error if multiple selection is used

See original GitHub issue

Bug, 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:closed
  • Created 7 years ago
  • Reactions:5
  • Comments:13 (7 by maintainers)

github_iconTop GitHub Comments

3reactions
devversioncommented, Aug 15, 2016

This seems to be intentionally while looking at the source.

I think it would be probably good to support ngModel for multiple mode as well, and emit an array of the selected md-button-toggle’s to the ngModel.

0reactions
angular-automatic-lock-bot[bot]commented, Sep 8, 2019

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found