SHARE
TWEET

Untitled

a guest Nov 15th, 2019 78 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import { EmployeeDetailsComponent } from '../employeedetails/
  2. employee-details.component';
  3. import { Observable } from "rxjs";
  4. import { EmployeeService } from "../employee.service";
  5. import { Employee } from "../employee";
  6. import { Component, OnInit } from "@angular/core";
  7. import { Router } from '@angular/router';
  8. @Component({
  9. selector: "app-employee-list",
  10. templateUrl: "./employee-list.component.html",
  11. styleUrls: ["./employee-list.component.css"]
  12. })
  13. export class EmployeeListComponent implements OnInit {
  14. employees: Observable<Employee[]>;
  15. constructor(private employeeService: EmployeeService,
  16. private router: Router) {}
  17. ngOnInit() {
  18. this.reloadData();
  19. }
  20. reloadData() {
  21. this.employees =
  22. this.employeeService.getEmployeesList();
  23. }
  24. export class Employee {
  25. deleteEmployee(id: number) {
  26. this.employeeService.deleteEmployee(id)
  27. .subscribe(
  28. data => {
  29. console.log(data);
  30. this.reloadData();
  31. },
  32. error => console.log(error));
  33. }
  34. employeeDetails(id: number){
  35. this.router.navigate(['details', id]);
  36. }
  37. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top