I am currently working on a code that displays a table on the main page with two buttons, "Edit" and "Delete", for each row. When the Edit button is clicked, a modal opens up. My question is, how can I pass the "employee id" of a specific employee to the edit modal component when the Edit button is clicked? For example, if the employee has an id of "101" and I want to edit their information, how do I pass this "101" to the edit modal component on button click in order to populate the details of that employee in text boxes within the modal?
@Component({
selector: 'ops-employee',
pipes: [],
styles: [],
template: `
<ops-addmodal [(open)]="addEmployeeOpen" (check)="updateEmployeeList($event)"></ops-addmodal>
<ops-editmodal [(open)]="editEmployeeOpen" [data]="editId" (check)="editEmployeeList($event)">
</ops-editmodal>
<div class="col-md-8 col-md-offset-2">
<h1> Employee Info </h1>
<hr>
<button class="btn btn-lg btn-primary" (click)="addEmployee()">Add</button>
<table class="table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Age</th>
<th>Role</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<tr *ngFor = "#employee of employeeDetails">
<td>{{employee.empName}}</td>
<td>{{employee.empAge}}</td>
<td>{{employee.empRole}}</td>
<td>
<button class="btn btn-sm btn-default" (click)="editEmployee(employee.empId)">Edit</button>
<button class="btn btn-sm btn-danger" (click)="deleteEmployee(employee.empId)">Delete</button>
</td>
</tr>
</tbody>
</table>
</div>
`,
directives: [AddEmployeeModalComponent, EditEmployeeModalComponent, ModalComponent]
})