import { Injectable } from '@angular/core' ; import { HttpClient } from '@angular/common/http' ; @ Injectable ( { providedIn : 'root' } ) export class DocService { constructor ( private http ) { } getMarkdownDoc ( markDownDocUrl ) { return this . http . get ( markDownDocUrl , { responseType : 'text' , } ) . toPromise ( ) . then ( response => { return response ; } ) . catch ( this . handleError ) ; } private handleError ( error ) { console . error ( 'An error occurred' , error ) ; return false ; } }