I am having an constant error that tends to pop up in my code (using Visual Studio Code as my IDE):
Property subscribe does not exist on type 'void'.....
When I run the code, I get an error message in Ionic localhost.
import { Component, OnInit } from '@angular/core';
import { NewsService } from '../news.service';
@Component({
selector: 'app-news',
templateUrl: './news.page.html',
styleUrls: ['./news.page.scss'],
})
export class NewsPage implements OnInit {
constructor(private newsService: NewsService) { }
ngOnInit() {
this.newsService.getData('everything?q=bitcoin&from=2018-10-09&sortBy=publishedAt')
.subscribe(data => {
console.log(data);
});
}
}