Angular-Consuming HTTP service

Using the fake server

First of all, in order to use http, we need to import HttpModule inside @angular/http

import {HttpModule} from '@angular/http';
import { Component, OnInit } from '@angular/core';
import { Http } from '@angular/http';

  selector: 'app-post',
  templateUrl: './post.component.html',
  styleUrls: ['./post.component.css']
export class PostComponent implements OnInit {

  constructor(http: Http) {
    http.get('').subscribe(response =>{

  ngOnInit() {



Leave a Reply

Your email address will not be published. Required fields are marked *