Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

angular6 Error in Property 'subscribe' does not exist on type 'void'

Tags:

angular6

this._weatherService.getWeather(this.location.city,this.location.code).subscribe((response) => {
     console.log(response);
     this.weather = response;
   });

getting this error "message": "Property 'subscribe' does not exist on type 'void'."

like image 385
darshan bagrecha Avatar asked May 03 '26 14:05

darshan bagrecha


1 Answers

Your issuse is because you did not return anything from getWeather()

As said in error void(means you did not return anything)

SO in getWeather() use return:

getWeather(..){
...
return whatever_you_have_to_return;
}
like image 116
לבני מלכה Avatar answered May 07 '26 08:05

לבני מלכה



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!