To separate API logic from the component, we are creating the API client as a separate class. This example class makes a request to Wikipedia API to get random wiki articles.
import { Http, Response } from '@angular/http';
import { Injectable } from '@angular/core';
import { Observabl...