I'm trying to dynamically set the ngModel to bind two input elements together while having a default value come from one of them. I'm passing in data like
[
{
name: modelName,
defaultValue: 'default'
},
{
name: modelName
}
]
And trying to get two input fields that are bound together that will both end up with that default value. This is just pretend data, It's coming in differently which is why they don't both have the default value.
I'm currently binding the fields like (not sure how to tie in the default value):
<div *ngFor="let data of dataArray">
<input [(ngModel)]="models[data.name]" [name]="data.name" />
</div>
With the models array just being a variable in the component going off of this question/answer