I am working with an array that looks something like this:
[
{
f_name: "c_name",
title: "k c name",
con_name: "cname",
path: "this.dialogData.name"
},
{
f_name: "c_num",
title: "k c num",
con_name: "cnum",
path: "this.dialogData.number"
}
]
In the html file, I'm looping through this array as follows:
<mat-form-field *ngFor ="let f of fields">
<mat-label>{{f.title}}</mat-label>
<input formControlName={{f.con_name}} matInput name={{f.con_name}} value={{f.path}}>
</mat-form-field>
Everything is working as expected except the {{f.path}} is coming up as the string as opposed to the variable.
So for example, in the first question, the value is set to this.dialogData.name as opposed to test_name which is the value that corresponds to the variable this.dialogData.name.
Is there anything I can do to refer to the underlying variable? As opposed to having the value as the path string.
this.dialogDatawhen creating thefieldsarray, why not initialize the propertypathwith the values of"this.dialogData.name"instead of a string?