Created
September 2, 2016 01:19
-
-
Save IEvangelist/760f4575a4067faf32e8e8b865eee1c3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {Observable} from "RxJS/Rx"; | |
import {Injectable} from "@angular/core"; | |
import {Http} from "@angular/http"; | |
@Injectable() export class ExampleService { | |
constructor(private http: Http) { } | |
getFooBars(onNext: (fooBars: FooBar[]) => void) { | |
this.get("api/foobar") | |
.map(response => <FooBar[]>reponse.json()) | |
.subscribe(onNext, | |
error => | |
console.log("An error occurred when requesting api/foobar.", error)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment