Need to get in tile.js account info that available in tile.html Got 4 different components: selector, list(nesting selector), details(nesting selector), tile(nesting list). From apex controller passing query of accounts to list, and then 1 account with parameters to each tile. Need to get click from tile and pass clicked account info to detail component. Passing this.account.id in CustomEvent gives nothing or error. So how can i get any account data in js that i got in html(for example i got name {account.name} in html, but i cant get name like this.account.name in js), and be a pass it to parent component? Thanks in advance.
tile.html
<template>
<a onclick={tileClick}>
<img src={account.image__c} width="200" height="200" >
Account Name: {account.Name}
Account Owner: {account.OwnerId}
Account Budget: {account.Budget__c}
Account Employees Number: {account.NumberOfEmployees}
Account Type : {account.type}
</a>
</template>
tile.js
import { LightningElement, api, track } from 'lwc';
export default class Tile extends LightningElement {
@api account;
tileClick() {
const event = new CustomEvent('tileclick', {
detail: this.account.id
});
this.dispatchEvent(event);
}
}