Skip to content

Instantly share code, notes, and snippets.

@IEvangelist
Created January 12, 2016 19:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save IEvangelist/1606dcd3c85423e51bc6 to your computer and use it in GitHub Desktop.
Save IEvangelist/1606dcd3c85423e51bc6 to your computer and use it in GitHub Desktop.
import "rxjs/Rx"
import {Http} from "angular2/http";
import {Injectable} from "angular2/core";
@Injectable()
export class ApiService {
constructor(private http: Http) { }
get(onNext: (json: any) => void) {
this.http.get("api/random").map(response => response.json()).subscribe(onNext);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment