Skip to content

Instantly share code, notes, and snippets.

Created Jan 24, 2016
What would you like to do?
import {Http} from 'angular2/http';
import {Injectable} from 'angular2/core';
import {Observable} from "rxjs";
export class HelloService {
private _sayHelloServiceUrl: String = '/api/hello/';
constructor(private http: Http) { }
public sayHello(name: string): Observable<string> {
var url = `${this._sayHelloServiceUrl}?name=${name}`;
return this.http.get(url).map(res => res.json().message);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment