Calling Observable method using subscribe and return data in a subscribe 'd call. Calling method: onClick(fileName){ this ._service. getFiles (fileName). subscribe (filestring => { console.log('filestring',filestring.fileContent); }, (err) => { console.log( 'Error to get file' ,err); }); } Called method: getFiles ( fileName ): Observable <any> { return this ._http .get( this .baseUrl + '/' + fileName , this .options()) . map ((res: Response) => res.json() ) }
From the tech stacks I climbed and learned