import { Injectable } from "@angular/core" ; import { Http } from "@angular/http" ; import { Observable , } from "rxjs/Rx" ; import "rxjs/add/operator/map" ; @ Injectable ( ) export class HelloService { constructor ( private http ) { } greet ( name ) { return this . http . get ( `/api/hello?name=${ name }` ) . map ( res => { return < string > res . text ( ) ; } ) ; } }