Angular5 has just come into contact with, a lot of things are not very familiar.
I want to click on a certain line of Table and dynamically insert a piece of HTML code at the bottom of the click line, but after insertion, the original click event disappears. Do you gods have any good solutions?
the HTML code is as follows:
<table class="table">
<thead>
<tr>
<th scope="col">-sharp</th>
<th scope="col">First</th>
<th scope="col">Last</th>
<th scope="col">Handle</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let item of [1, 2, 3, 4, 5]" class="alarm-info" (click)="onClickDetailPanel($event, "1")" data-toggle="collapse" data-target="-sharpcollapseL1" aria-expanded="false" aria-controls="collapseL1">
<th scope="row">{{item}}</th>
<td>Mark</td>
<td>Otto</td>
<td>@mdo</td>
</tr>
</tbody>
</table>
the ts code is as follows:
onClickDetailPanel(e, params) {
console.log("detail panel," + e + ", params:" + params);
$(".alarm-detail-panel").remove();
var tempHTML = `
<tr class="alarm-detail-panel">
<th colspan="4">
<div id="collapseL1" class="collapse" data-parent="-sharpcollapseOne">
<div class="card-body">
Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven"t heard of them accusamus labore sustainable VHS.
</div>
</div>
</th>
</tr>
`;
e.currentTarget.outerHTML += tempHTML;
}