Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- export class EmployeeService {
- employees : AngularFireList<Employee>;
- Employee : AngularFireObject<any>;
- constructor( public af : AngularFireDatabase) {
- this.employees = this.af.list<Employee>('/employees/employees');
- }
- getEmployees()
- {
- return this.employees.valueChanges();
- }
- }
- *Heres employee component : *
- employees:Employee[];
- constructor(public employeeService : EmployeeService) {
- }
- ngOnInit() {
- this.employeeService.getEmployees().subscribe(employees=>{
- this.employees=employees;
- console.log(this.employees);
- });
- }
- Heres the employee.html:
- <tr *ngFor="let item of employees">
- <th >{{item.firstName}}</th>
- <th >{{item.lastName}}</th>
- <th >{{item.email}}</th>
- <th >{{item.country}}</th>
- <th >{{item.city}}</th>
- <th >{{item.phone}}</th>
- <th >{{item.salary}}</th>
- <th >{{item.$key}}</th>
- </tr>
- any one is having an idea?
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement