Im having problem to get value change from a component property. In this simple example, I have an ngFor that create instance of TextField Component passing fields[i].value as property. I value has a default, its correctly printed on input but the changes are not reflected on the original model.
<ng-container *ngFor="let field of fields.all(); let i = index;">
<dynamic-text-field
[id] = "field.name"
[name] = "field.name"
[label] = "field.label"
[note] = "field.translate_help"
[(val)] = "fields[i].value"
>
</dynamic-text-field>
</ng-container>
export class TextField
{
@Input() id : string = "";
@Input() name : string = "";
@Input() note : string = "";
@Input() label : string = "";
@Input() val : string = null;
[...]
}
<mat-label translate> {{ label | translate }} </mat-label>
<input matInput placeholder="" [(ngModel)]="val" name="{{name}}" />