Created
July 2, 2017 18:23
-
-
Save stevermeister/c17fda19ba1982fe35971c25cfb5bc3f 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 { Injectable } from '@angular/core'; | |
import { Http } from '@angular/http'; | |
import { Observable } from 'rxjs/Observable'; | |
import 'rxjs/add/operator/map'; | |
@Injectable() | |
export class UserService { | |
constructor(private http: Http) { } | |
getOne(userId: number) { | |
return this.http.get(`/users/${userId}`).map(result => result.json()); | |
} | |
getAll() { | |
return this.http.get(`/users`).map(result => result.json()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment