I am new to angular and trying to make an COVID-19 app in angular where I am showing data in tabular form. I have two components, a state component and district component.
State component is listing all state in table and when I click on any state. It should load all districts listed below that state. But it is expanding my width of my state column of state component which results in unexpected width of table.
Here is my stack blitz link: enter link description here
Here is my expected result link: Expected result
Here is my piece of code
State.component.html
<table>
<tbody *ngFor="let data of statewisedata;let i=index ">
<span class="dropdown rotateDownRight ">
<svg xmlns="http://www.w3.org/2000/svg " width="24 " height="24 " viewBox="0 0 24 24 " fill="none " stroke="currentColor " stroke-width="2 " stroke-linecap="round " stroke-linejoin="round">
<polyline points="6 9 12 15 18 9 "></polyline>
</svg>
</span>
<tr class="state ">
<td (click)="OngetState(data.state); showHideData(data) " style="font-weight: 600; ">{{data.state}}</td>
<td style="color: inherit; ">
<span *ngIf='DailystateStatus[i]?.confirmed !==0 || DailystateStatus[i]?.confirmed < 0 ;' class="deltas " style="color: rgb(255, 7, 58); ">
<svg xmlns="http://www.w3.org/2000/svg " width="24 " height="24 " viewBox="0 0 24 24" fill="none " stroke="currentColor " stroke-width="2 " stroke-linecap="round " stroke-linejoin="round ">
<line x1="12 " y1="19 " x2="12 " y2="5 "></line>
<polyline points="5 12 12 5 19 12 "></polyline>
</svg>
{{DailystateStatus[i]?.confirmed}}
</span>
{{data.confirmed}}
</td>
<td style="color: inherit; ">{{data.active}}</td>
<td style="color: inherit; ">{{data.recovered}}</td>
<td style="color: inherit; ">{{data.deaths}}</td>
</tr>
<tr app-district *ngIf="data[ 'show'] "></tr> //here loading list
</tbody>
</table>
District.component.html
<tr *ngFor="let data of districtdata|keyvalue" class="district" style="background: rgb(248, 249, 250);">
<td style="font-weight: 600;"> {{data.key}}</td>
<td><span class="deltas" style="color: rgb(255, 7, 58);"></span>{{data.value.confirmed}}</td>
</tr>
District.component.ts
@Component({
selector: '[app-district]',
templateUrl: './district.component.html',
styleUrls: ['./district.component.css']
})
If I try to wrap my district component in div instead of tr and If I try to increase width of that div it increase width of my state column in state component
<div *ngFor="let data of districtdata|keyvalue" class="district" style="width:500px">
<td style="font-weight: 600;"> {{data.key}}</td>
<td><span class="deltas" style="color: rgb(255, 7, 58);"></span>{{data.value.confirmed}}</td>
</div>