Promise<Article[]> articles = this.http.get('api.learn-angular.fr/articles') | |
.toPromise() | |
.then((res: Response) => res.json() as Article[]) | |
.catch(this.handleError); | |
... | |
private handleError(error: any): Promise<any> { | |
console.error('Une erreur est survenue : ', error); | |
return Promise.reject(error.message || error); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment