Last active
August 9, 2017 00:37
-
-
Save cartant/2f7c7bdcfad5f409bd3821025877e424 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
@Injectable() | |
export class UserSearchService { | |
constructor(private _http: Http) {} | |
searchUsers(username: string): Observable<User[]> { | |
return username ? | |
this._http.get(`https://api.github.com/search/users?q=${username}`) | |
.map(response => response.json()) | |
.map(content => content.items) : | |
Observable.of<User[]>([]); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment