How does angular5 get a piece of html code assigned to another place, and the (click) event in html still works?

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;
  }
Mar.11,2021

does not evaluate your code, but you need to switch from jq thinking. Dynamically added html cannot use angular instructions or events.

the simplest idea, have used ngIf control:

//
export class XXComponent{
    let tableLists:any[] = [
        { name:1,showTemp:false },
        { name:2,showTemp:false },
        { name:3,showTemp:false },
        { name:4,showTemp:false },
        { name:5,showTemp:false }
    ]
    ...
    onClickDetailPanel(index:number){
        this.tableLists[index].showTemp = !this.tableLists[index].showTemp
    }
}
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3e117-2c3d6.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3e117-2c3d6.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?