angular / components

Component infrastructure and Material Design components for Angular
https://material.angular.io
MIT License
24.37k stars 6.75k forks source link

Button toggle group acts wrong if value is null #14059

Open konsultaner opened 6 years ago

konsultaner commented 6 years ago

Bug: If a button in a button group has a value of null, it is not selected on the first button click

What is the expected behavior?

buttuns with a value of null should be selectable

What is the current behavior?

buttons are only sometimes selectable

What are the steps to reproduce?

         <mat-button-toggle-group class="margin-left" [value]="service.booked"  (change)="service.active = $event.value;">
            <mat-button-toggle [value]="true">
                <mat-icon>assignment_turned_in</mat-icon> booked
            </mat-button-toggle>
            <mat-button-toggle [value]="false">
                <mat-icon>find_in_page</mat-icon> not booked
            </mat-button-toggle>
            <mat-button-toggle [value]="null">
                <mat-icon>description</mat-icon> all
            </mat-button-toggle>
        </mat-button-toggle-group>

What is the use-case or motivation for changing an existing behavior?

Java has Boolean values that can eigther be null, true or false. I use this value to map it to a java object.

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

definitely angular material 7+

david-genger commented 4 years ago

Same issue. Angular 9.