There is a requirement to show an in-place row details when I click on an inspector icon of the table which would expand or collapse just like a toggle on click of a button
<table class="table">
<thead>
<tr>
<th style="width:200px;">Name</th>
<th>Created On</th>
<th>Last Modified</th>
</tr>
</thead>
<tbody>
<ng-container *ngFor="let item of menuList">
<tr>
<td style="width:10px" attr.data-target=".row{{item._id}}" data-toggle="collapse"
data-role="expander">
<span *ngIf="item.SubMenu?.length && item.SubMenu[0].MenuName!==undefined"
class="fa fa-plus" (click)="toggleChildren($event)">
</span> {{ item.MenuName }}
</td>
<td>{{ item.CreatedBy }}</td>
<td>{{ item.CreatedDate }}</td>
</tr>
<ng-template [ngIf]="item.SubMenu.length>0">
<ng-container *ngFor="let subitem of item.SubMenu">
<tr class="collapse row{{subitem.ParentId}}" aria-expanded="true">
<td style="width:10px" attr.data-target=".row{{subitem._id}}"
data-toggle="collapse"
data-role="expander">
<span *ngIf="subitem.SubMenu?.length && subitem.SubMenu[0].MenuName!==undefined"
class="fa fa-plus" (click)="toggleChildren($event)">
</span> {{ subitem.MenuName }}
</td>
<td>{{ subitem.CreatedBy }}</td>
<td>{{ subitem.CreatedDate }}</td>
</tr>
<ng-template [ngIf]="subitem.SubMenu.length>0">
<ng-container *ngFor="let sub of subitem.SubMenu">
<tr class="collapse row{{sub.ParentId}}" aria-expanded="true">
<td> {{ sub.MenuName }}</td>
<td>{{ sub.CreatedBy }}</td>
<td>{{ sub.CreatedDate }}</td>
</tr>
</ng-container>
</ng-template>
</ng-container>
</ng-template>
</ng-container>
</tbody>
</table>
Very similar to what I answered here: Angular Material Collapsible Card
StackBlitz: https://stackblitz.com/edit/angular-kxkckz
You'll need something like below if you don't want to use any packages:
<style>
table, th, td {
border: 1px solid black;
border-collapse: collapse;
}
th, td {
padding: 5px;
text-align: left;
}
</style>
<table fixed>
<tr>
<td>
Click to toggle content 1
<button (click)="collapsed1=!collapsed1">Toggle me</button>
</td>
</tr>
<tr *ngIf="!collapsed1">
<td>
<p>Showing content 1</p>
<p>Grass is green</p>
</td>
</tr>
<tr>
<td>
Click to toggle content 2
<button (click)="collapsed2=!collapsed2">Toggle me</button>
</td>
</tr>
<tr *ngIf="!collapsed2">
<td>
<p>Showing content 2</p>
<p>The sky is blue</p>
</td>
</tr>
</table>