angular-material-extensions / select-country

Angular Material component that allow users to select a country or nationality with an autocomplete feature
https://angular-material-extensions.github.io/select-country/
MIT License
126 stars 40 forks source link

[showCallingCode] binding is not working #81

Closed elonaire closed 2 years ago

elonaire commented 3 years ago

Describe the bug A clear and concise description of what the bug is.

To Reproduce Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

Smartphone (please complete the following information):

Additional context Add any other context about the problem here.

Rogermax commented 3 years ago

In the commit "example demo showCallingCode" of the PR #80 I made a demo changing the [showCallingCode] binding and it's working. Maybe you are passing a string instead of a boolean?

If you're using a mat-select for example the value returned by the select is a string not a boolean. So it could be done this way:

TS

  showCallingCode = 'false';

HTML

        <div>
            <mat-form-field appearance="fill">
                <mat-label>Choose showCallingCode</mat-label>
                <mat-select [(value)]="showCallingCode">
                    <mat-option value="true">true</mat-option>
                    <mat-option value="false">false</mat-option>
                </mat-select>
            </mat-form-field>
        </div>
        <mat-select-country appearance="outline"
                            label="Country"
                            [language]="languageSelected"
                            [autocomplete]="'no'"
                            [showCallingCode]="showCallingCode == 'true'"
                            (onCountrySelected)="onCountrySelected($event)">
        </mat-select-country>
AnthonyNahas commented 2 years ago

80 is already merged