My for:each loop fails with this TypeError:
Uncaught (in promise) TypeError: t[Yn] is not a function
at i (aura_prod.js:3)
at n (/flexipageEditor/modules/c/eventWithData.js:4)
at mo (aura_prod.js:3)
at yr (aura_prod.js:3)
at bo (aura_prod.js:3)
at aura_prod.js:3
at To (aura_prod.js:3)
at cr (aura_prod.js:3)
at Array.ir (aura_prod.js:3)
at Bt (aura_prod.js:3)
The code looks like this:
<template> <lightning-card title="EventWithData" icon-name="standard:logging">
<div class="slds-m-around_medium">
<template if:true={contacts.data}>
<p>Gopal Singh</p>
<template for:each={contacts} for:item='con'>
<p key={con.id}>{con.Title}</p>
</template>
</template>
</div>
</lightning-card>
</template>
Best Answer
You need to iterate over contacts.data: