I am trying to get object value dynamically using nested for each loop in HTML. EX: In JS I have record somthing like this :
this.tempData = [{ 'field1': 'name', 'field2': 'type' }];
this.fields = ['field1', 'field2'];
In HTML Displaying values:
<template for:each={tempData} for:item="i" for:index="index">
<template for:each={fields} for:item="field" for:index="index1">
<div key={field}>
{i.field}
</div>
</template>
</template>
but not able to get the record value ,however when I am using record statically like :
{i.field1}
{i.field2}
I am able to see the values . Please correct me where I am going worng?
{i[field]}
.