Take a look at the code snippet here
HTML
TypeScript
data = [
{
name: 'server1',
humidity: '50.9'
},
{
name: 'server2',
humidity: '52.9',
},
{
name: 'server3',
humidity: '53.9',
}
]
humidityPercentage: any;
constructor() { }
ngOnInit() {
for (let x = 0; x <= this.data.length; x++) {
this.humidityPercentage = this.data[x].humidity + '%';
}
}
The goal here is to make the displayed data dynamic based on the index. For example, if the first item has a humidity of 50.9, it should display as 50.9.
The current issue is that it only displays the last data and does not take into account the index. https://i.stack.imgur.com/i5FWY.png