1. lab assignment angular directives
1. lab assignment angular directives
Use employees json data given to print on ui using ngIf and ngFor, if no employee record is there
application should print no employee inforation is found.
@Component({
selector: 'list-employee',
templateUrl: 'app/employee/employeeList.component.html',
styleUrls: ['app/employee/employeeList.component.css']
})
export class EmployeeListComponent {
employees: any[] = [
{
code: 'emp101', name: 'Raj', gender: 'Male',
annualSalary: 5500, dateOfBirth: '25/6/1988'
},
{
code: 'emp102', name: 'Keshav', gender: 'Male',
annualSalary: 5700.95, dateOfBirth: '9/6/1982'
},
{
code: 'emp103', name: 'Gunika', gender: 'Female',
annualSalary: 5900, dateOfBirth: '12/8/1979'
},
{
code: 'emp104', name: 'Ekta', gender: 'Female',
annualSalary: 6500.826, dateOfBirth: '14/10/1980'
},
];
}
html page:
---------
<table>
<thead>
<tr>
<th>Code</th>
<th>Name</th>
<th>Gender</th>
<th>Annual Salary</th>
<th>Date of Birth</th>
</tr>
</thead>
<tbody>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
css:
-------
table {
color: #369;
font-family: Arial, Helvetica, sans-serif;
font-size: large;
border-collapse: collapse;
}
td {
border: 1px solid #369;
padding:5px;
}
th{
border: 1px solid #369;
padding:5px;
}