How can I check if a JSON response is empty?
GetEmpName(){
this.Emp.empservicecall()
.subscribe(response => {
console.log(response);
this.name = response[0].name
});
}
You can check if it is having values or not by
if(response && response.length > 0)
in order to fix compile time error, you need to define a type for the response, make it as any
this.Emp.empservicecall()
.subscribe((response : any) => {