Skip to content
This repository has been archived by the owner on Oct 7, 2020. It is now read-only.

[select] doesn't show initial selection when values are boolean type. #2251

Open
martinraie opened this issue Apr 26, 2020 · 2 comments
Open

Comments

@martinraie
Copy link

Describe the bug
MdcSelect doesn't show initial selection when values are boolean type.

To Reproduce
Steps to reproduce the behavior:

  1. Add following mdc-select in template:
  <mdc-select name="selectSmth" [(ngModel)]="selectedValue">
    <mdc-menu>
      <mdc-list>
        <mdc-list-item value="true">Positive</mdc-list-item>
        <mdc-list-item value="false">Negative</mdc-list-item>
      </mdc-list>
    </mdc-menu>
  </mdc-select>
  1. Add boolean type initial value to component:
selectedValue = false;
  1. When opening the page I expect select's value to be "Negative" but it is blank instead.

Expected behavior
I expect "Negative" (value false) to be selected as initial value in the select box.

What Angular MDC version are you using?
5.1.1

What OS are you using?:
Ubuntu 18.04

What browser(s) is this bug affecting?:
Chrome

Additional context
It worked with MDC 3.2.1 and it works with vanilla Angular select/option

@trimox
Copy link
Owner

trimox commented Apr 26, 2020

@martinraie Thanks for reporting and including steps to reproduce. Will review..

@martinraie
Copy link
Author

Tried it also with square brackets like this:

        <mdc-list-item [value]="true">Positive</mdc-list-item>
        <mdc-list-item [value]="false">Negative</mdc-list-item>

Then the true option started to work but false still doesn't work.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants