<app-employeecount [all]= "gettotalemployeescount()"
<app-employeecount [all]= "gettotalemployeescount()"
[male]= "gettotalmaleemployeescount()"
[female]="gettotalfemaleemployeescount()"
(onEmployeeCountRadioButtonChange) = "onEmployeeCountRadioButtonChange($event)">
</app-employeecount>
<br/>
<table>
<thead>
<tr>
<th>id</th>
<th>name</th>
<th>Gender</th>
<th>mobile</th>
<th>Salary</th>
<th>Date of joining</th>
</tr>
</thead>
<tbody>
<ng-container *ngFor = "let employ of employeelist;">
<tr *ngIf = "selectedEmployeeCountRadioButton=='All' || selectedEmployeeCountRadioButton=employ.gender">
<td>{{employ.id}}</td>
<td>{{employ.name}}</td>
<td>{{employ.gender}}</td>
<td>{{employ.mobile}}</td>
<td>{{employ.Salary | currency:'USD':'1.2-3'}}</td>
<td>{{employ.Doa | date:'dd/MM/y' | uppercase}}</td>
</tr>
</ng-container>
<tr *ngIf = "!employeelist || employeelist.length==0">
<td colspan="6">No Students are available right now</td>
</tr>
</tbody>
</table>
&#13;
[male]= "gettotalmaleemployeescount()"
[female]="gettotalfemaleemployeescount()"
(onEmployeeCountRadioButtonChange) =
"onEmployeeCountRadioButtonChange($event)">
</app-employeecount>
<br/>
<table>
<thead>
<tr>
<th>id</th>
<th>name</th>
<th>Gender</th>
<th>mobile</th>
<th>Salary</th>
<th>Date of joining</th>
</tr>
</thead>
<tbody>
<ng-container *ngFor = "let employ of employeelist;">
<tr *ngIf = "selectedEmployeeCountRadioButton=='All' ||
selectedEmployeeCountRadioButton=employ.gender">
<td>{{employ.id}}</td>
<td>{{employ.name}}</td>
<td>{{employ.gender}}</td>
<td>{{employ.mobile}}</td>
<td>{{employ.Salary | currency:'USD':'1.2-3'}}</td>
<td>{{employ.Doa | date:'dd/MM/y' | uppercase}}</td>
</tr>
</ng-container>
<tr *ngIf = "!employeelist || employeelist.length==0">
<td colspan="6">No Students are available right now</td>
</tr>
</tbody>
</table>
答案 0 :(得分:0)
您正在为* ngIf
中的selectedEmployeeCountRadioButton分配值执行此操作<tr *ngIf = "selectedEmployeeCountRadioButton=='All' || selectedEmployeeCountRadioButton==employ.gender"></tr>
而不是<tr *ngIf = "selectedEmployeeCountRadioButton=='All' || selectedEmployeeCountRadioButton=employ.gender"></tr>