samarthagarwal
9/24/2018 - 2:36 PM

IF_06_05_home.page.ts_3

\!h posts: any[] = [];

constructor(httpClient: HttpClient){

    // Making the GET request
    httpClient.get("https://jsonplaceholder.typicode.com/posts").subscribe((response) => {

      // Request succeeded
\!h       console.log(response)
\!h       this.posts = response as any[];

    }, (error) => {

      // Request failed with an error
\!h       console.log(error);
    })
  }