Created
June 14, 2017 21:10
-
-
Save michaelchadwick/59de56c93df8ffcaee933083bfa1d618 to your computer and use it in GitHub Desktop.
angular 2 testing - DaveService
This file contains 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 { Headers, Http, Response } from '@angular/http'; | |
import { Observable } from 'rxjs/Observable'; | |
import 'rxjs/add/operator/map'; | |
import 'rxjs/add/operator/catch'; | |
import { devlog } from '../_helpers/devlog'; | |
@Injectable() | |
export class DaveService { | |
private localAPI = 'http://localhost:3002/?api=1'; | |
constructor(private http: Http) {} | |
daveCheckObservable() { | |
devlog('api', 'daveService.daveCheckObservable()') | |
return this.http.get(this.localAPI) | |
.map((response: Response) => { | |
return response.json(); | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment