I am following this video tutorial (text version of the same). I have followed exactly the same code and I am receiving this error:
error TS2339: Prop
I would also subscribe to the service method instead of saving it to another value in ngOnInit()
:
ngOnInit() {
this.employees = this._EmployeeService.getEmployees();
}
To something like:
ngOnInit(){
this.getEmployees()
}
private getEmployees(): void {
this._EmployeeService.getEmployees()
.subscribe(fetchedEmployees = > this.employees = fetchedEmployees)
}