i have this problem, my app working fine but this error shows in IDE.
employee.service.ts :
import { Injectable } from '@angular/core';
@Injectable({
providedIn: 'root'
})
export class EmployeeService {
getEmployee(){
return [
{"id":1,"name":"Micheal","age":21},
{"id":2,"name":"Jackson","age":22},
{"id":3,"name":"Hales","age":23},
{"id":4,"name":"Moz","age":25}
];
}
constructor() { }
}
and my employeeDetail.ts file is this:
import { Component, OnInit } from '@angular/core';
import { EmployeeService } from '../services/employee.service';
@Component({
selector: 'employee-detail',
templateUrl: './employee-detail.component.html',
styleUrls: ['./employee-detail.component.css']
})
export class EmployeeDetailComponent implements OnInit {
public employees = [];
constructor(private _employeeService : EmployeeService) {
}
ngOnInit() {
this.employees = this._employeeService.getEmployee();
}
}
Here is the Employee-list.ts
import { Component, OnInit } from '@angular/core';
import {HttpClientModule} from '@angular/common/http';
import { EmployeeService } from '../services/employee.service';
@Component({
selector: 'employee-list',
templateUrl: './employee-list.component.html',
styleUrls: ['./employee-list.component.css']
})
export class EmployeeListComponent implements OnInit {
public employees = []
constructor(private _employeeService : EmployeeService) {
}
ngOnInit() {
this.employees = this._employeeService.getEmployee();
}
}
how can I solve this problem? what is the actual problem? as I am new to angular6 so I cannot figure out the error, please explain this. Thank you.