I got error Error: _co.bellowContent is undefined when to display data. You can refer my code bellow.
I got error Error: _co.bellowContent is undefined when to display data. You can refer my code bellow.
app.component.html
<table class="table">
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">First</th>
<th scope="col">Last</th>
<th scope="col">Title</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let tableRow of table" (click)="open(tableRow)">
<th scope="row">{{tableRow.id}}</th>
<td>{{tableRow.first}}</td>
<td>{{tableRow.last}}</td>
<td>{{tableRow.title}}</td>
</tr>
</tbody>
</table>
<div>
<p>id: {{ bellowContent.id }}</p>
<p>first: {{ bellowContent.first }}</p>
<p>last: {{ bellowContent.last }}</p>
<p>title: {{ bellowContent.title }}</p>
</div>
And
app.component.ts
bellowContent:undefined
table = [
{
"id": 1,
"first":"Robin",
"last": "William",
"title": "back end developer"
},{
"id": 2,
"first":"Mark",
"last": "Thornton",
"title": "front end developer"
},{
"id": 3,
"first":"Tary",
"last": "Huction",
"title": "front end developer"
}
]
open(tableRow) {
this.bellowContent = tableRow
}
}
This is my code in stackBlitz