Skip to content

Input properties don't update/save correctly #140

@Servonius

Description

@Servonius

Describe the bug
I'm using the the mat-select-country inside a reactive form:

<form [formGroup]="form">
  <div formGroupName="companyAddress">
    <mat-select-country
      [label]="'COUNTRY' | translate"
      [placeHolder]="'SELECT_COUNTRY' | translate"
      appearance="fill"
      [required]="true"
      formControlName="country"
      [error]="'COUNTRY_INVALID' | translate"
      [language]="settingsService.activeLanguage$ | async"
    ></mat-select-country>
  </div>
</form>
<button
  mat-flat-button
  (click)="submit()"
  type="submit"
>
  {{ "SUBMIT" | translate }}
</button>
form = new FormGroup({
  companyAddress: new FormGroup({
    country: new FormControl<Country>(undefined),
  }),
});

submit() {
  if (this.form.invalid) {
    return;
  }

  // form valid
  console.log("submitted");
}

(Note: the FormGroups are nested because this is a minimal copy of the actual code)

But the following doesn't work:

  1. the appearance isn't filled (it's outline)
  2. it has no required marking
  3. there is no error shown when submitting the form and the form is still valid

The translation change is sometimes triggered during runtime by the user and this is working correctly, so the text are all getting translated.

Expected behavior

  1. the appearance should be fill
  2. there should be a required marking
  3. there should be an error shown when submitting the form and the form should be invalid

Screenshots
image

Desktop (please complete the following information):

  • OS: Win10 22h2
  • Browser: Microsoft Edge v120
  • Angular: v16
  • @angular-material-extensions/select-country: 16.0.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions