Correction de l'utilisation de l'attribut "disabled" dans le modèle du composant "entity-edit" au lieu d'utiliser l'attribut du contrôle.

This commit is contained in:
FyloZ 2021-02-07 20:00:46 -05:00
parent ecdb6f52c8
commit 93bae1504b
2 changed files with 2 additions and 2 deletions

View File

@ -61,7 +61,7 @@
let-control="control" let-field="field">
<mat-form-field *ngIf="field.options$ | async as options">
<mat-label>{{field.label}}</mat-label>
<mat-select [formControl]="control" [disabled]="field.readonly">
<mat-select [formControl]="control">
<mat-option *ngFor="let option of options" [value]="option.value">
{{option.label}}
</mat-option>

View File

@ -38,7 +38,7 @@ export class EntityEditComponent extends SubscribingComponent {
ngOnInit() {
const formGroup = {}
this.formFields.forEach(f => {
formGroup[f.name] = new FormControl(f.valueFn ? f.valueFn(this.entity) : this.entity[f.name], f.validator)
formGroup[f.name] = new FormControl({value: f.valueFn ? f.valueFn(this.entity) : this.entity[f.name], disabled: f.readonly}, f.validator)
})
this.form = this.formBuilder.group(formGroup)