Skip to content

Instantly share code, notes, and snippets.

@stevermeister
Created July 2, 2017 18:23
Show Gist options
  • Save stevermeister/c17fda19ba1982fe35971c25cfb5bc3f to your computer and use it in GitHub Desktop.
Save stevermeister/c17fda19ba1982fe35971c25cfb5bc3f to your computer and use it in GitHub Desktop.
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