import { Injectable } from '@angular/core';
import { Http } from '@angular/http';
import { User } from './user';
import { Observable } from "rxjs";

@Injectable()
export class UserListService {
    private userUrl: string = API_URL + "users/";
    constructor(private http:Http) { }

    getUsers(): Observable<User[]> {
        return this.http.request(this.userUrl + 'users').map(res => res.json());
    }

    getUserById(id: string): Observable<User> {
        return this.http.request(this.userUrl + id).map(res => res.json());
    }
}
import { Injectable } from '@angular/core';
import { Http } from '@angular/http';
import { User } from './user';
import { Observable } from "rxjs";

@Injectable()
export class UserListService {
    private userUrl: string = API_URL + "users";
    constructor(private http:Http) { }

    getUsers(): Observable<User[]> {
        return this.http.request(this.userUrl).map(res => res.json());
    }

    getUserById(id: string): Observable<User> {
        return this.http.request(this.userUrl + "/" + id).map(res => res.json());
    }
}
Fix URL bug in `UserListService`
Fix URL bug in `UserListService`

I had tried to clean up the URL handling in `UserListService`, but didn't
test it properly and we rolled it out in a broken state.

We probably want to add some tests for the service to catch problems
like this in the future.

Fixes #24
