Created
February 18, 2019 16:25
-
-
Save israeljrs/e761be07fb9f0cb790b84db1121871c8 to your computer and use it in GitHub Desktop.
exemplo de service.
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
import { Injectable } from '@angular/core'; | |
import { HttpClient } from '@angular/common/http'; | |
import { Observable } from 'rxjs'; | |
import { timeout } from 'rxjs/operators'; | |
@Injectable({ | |
providedIn: 'root' | |
}) | |
export class WebRequestService { | |
constructor(public http: HttpClient) { } | |
getArticle(): Observable<any> { | |
return this.http.get<any>('http://slowwly.robertomurray.co.uk/delay/2000/url/https://jsonplaceholder.typicode.com/todos/1') | |
.pipe( | |
timeout(1000) | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment