在这里,我有一个小的crud角度应用程序,我的问题是,如何获得表格行中显示的员工的ID,所以我可以做一个删除请求,当弹出窗口时应该确认(触发,我不知道)莫代尔弹出......

这是我的 class 员工

export class employee {
Id: string;
FirstName: string; 
Email: string;

 }

在我的服务

deleteEmployee(emp: employee) { 
    let headers = new Headers({ 'Content-Type': 'application/json' });
    let options = new RequestOptions({ headers: headers });
    return this.http.delete(url +  emp.Id);
    }

在我的组件中

DeleteEmployee(e: employee) {

  this._usermanagementservice.deleteEmployee(this.Demoemployee).subscribe(res 
  => {
        this.LoadAllEmployees();
    });
}
   DeleteEmp() {
    this.DeleteEmployee(this.Demoemployee);
    this.LoadAllEmployees();
    this.modalRef.hide();
    }

随着ngx bootstrap模式的调用

openModalDelete(templateDelete: TemplateRef<any>) {
    this.modalRef = this.modalService.show(templateDelete, this.config);
  }

在我的component.html中

<table style="width:100%" class="table table-striped" id="billing_history_table">
    <thead class="head">
        <tr>
            <th>Employee Name</th>
            <th>Position</th>
            <th>Mail</th>
            <th></th>
            <th></th>
            <th></th>
        </tr>
    </thead>
    <tbody>
        <tr *ngFor="let e of employeelist">
            <td>{{e.firstName}}</td>
            <td>{{e.positionId}}</td>
            <td>{{e.email}}</td>

            <td><a (click)="openModalDelete(templateDelete)"><span class="glyphicon glyphicon-trash"></span></a></td>
        </tr>
    </tbody>
</table>

和templateDelete的模板与确认按钮应该调用DeleteEmp函数(我猜)

<ng-template #templateDelete>
    <div class="modal-body text-center">
    <p>Do you want to confirm?</p>
    <button type="button" class="btn btn-default" 
    (click)="confirm()">Yes</button>
    <button type="button" class="btn btn-primary" 
    (click)="decline()">No</button>
    </div>

Noted that I have no issues with the api, or any errors in general, other parts of my app works just fine(like add new thru form, and else), and the popup modal works, opens small confirm dialog in which Yes button works(prints out some message on console etc.) I'm not sure, how can I get Id of the employee of the same row and then open modal which should take that id and pass it to my delete function called from component

我为我糟糕的英语道歉,我希望有人理解我的问题:/

PS . 我试过直接调用它,没有弹出窗口,从行中断开,点击glyphicon,然后找回错误...