Skip to content

Instantly share code, notes, and snippets.

@frontconnect
Last active January 31, 2018 20:51
Show Gist options
  • Save frontconnect/d414afd1df65f55260c01ed0be223164 to your computer and use it in GitHub Desktop.
Save frontconnect/d414afd1df65f55260c01ed0be223164 to your computer and use it in GitHub Desktop.
Test Service defined for testing REST calls with HTTPClient library
import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs/Observable';
@Injectable()
export class TestService {
private testUrl = '/some/test/url';
constructor(private http: HttpClient) { }
public testCall(): Observable<string> {
return this.http.get(this.testUrl);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment