Skip to content

Instantly share code, notes, and snippets.

@wKoza
Last active January 14, 2017 15:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wKoza/8a2136671a93dc85b1793a95377b61b9 to your computer and use it in GitHub Desktop.
Save wKoza/8a2136671a93dc85b1793a95377b61b9 to your computer and use it in GitHub Desktop.
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