So I have setup this service to console log the response from a News API like so:
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
@Injectable({
providedIn: 'root'
})
export class NewsApiService {
private url = 'https://jsonplaceholder.typicode.com/posts';
constructor(private http: HttpClient) { }
getArticles() {
this.http.get(this.url).subscribe(response => {
console.log(response);
});
}
}
This is something temporary I would like to do until I get up to speed with RxJS Observables, but I am getting nothing in the console and absolutely no error anywhere.