Expert
What does the following code do?
import {Service} from '@angular/core';
import {Http} from '@angular/http';
import {Issue} from './issue';
@Injectable()
export class HeroService {
constructor(private http: Http) {
}
getList(): Promise<Issue[]> {
return this.http.get('/issues/')
.toPromise()
.then((response) => {
return response.json() as Issue[];
})
.catch(this.handleError);
}
private handleError(error: any): Promise<any> {
console.error('An error occurred', error);
return Promise.reject(error.message || error);
}
}
Author: Mathieu RobinStatus: PublishedQuestion passed 447 times
Edit
0
Community EvaluationsNo one has reviewed this question yet, be the first!
Similar QuestionsMore questions about AngularJS