I'm trying to create three buttons and each button displays an image and a text. But it doesn't work and I can't understand why.
What I'm trying to achieve is that when I click on one of my three buttons an image and text appears. This image and text is unique for each button and I have to use ngFor.
Here is my code:
component.ts
export class FeaturesComponent implements OnInit {
title = 'Features';
buttonData = [{
title: 'Prediction',
description: 'text',
img: '../../assets/prediction.png'
},
{
title: 'Rebalancing',
description: 'text',
img: '../../assets/rebalancing.png'
},
{
title: 'Visualization',
description: 'text',
img: '../../assets/visualization.png'
}];
}
component.html
<h1>{{ title }}</h1>
<tr class="btn-group" *ngFor="let button of buttonData">
<td>
<button (click)="button.description; button.img">{{button.title}}</button>
</td>
</tr>