this is the GitHub code that I coded as it is watching his youtube video
Asked
Active
Viewed 52 times
-4

halfer
- 19,824
- 17
- 99
- 186

rahul goud
- 1
- 1
-
Welcome to stackoverflow. Please don't post code as links to images, but as text with proper code tags. – M. Deinum May 23 '22 at 08:41
1 Answers
1
The error is pretty clear so I can answer:
constructor(
employeeService: EmployeeService
) { ... }
When you write this, the scope of your variable is only the constructor itself.
To declare it as a class-scoped variable, you have to set it :
private employeeService: EmployeeService;
constructor(
employeeService: EmployeeService
) {
this.employeeService = employeeService;
}
You can also use typescript's shortcut feature like such :
constructor(
private employeeService: EmployeeService
) { ... }
Which will achieve the same result.

halfer
- 19,824
- 17
- 99
- 186