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 457 times
Edit
0
Community EvaluationsNo one has reviewed this question yet, be the first!
1
AngularJS: How to fix the error 'Cannot assign to 'bar' because it is a constant or a read-only property.'1
What are the lifecycle hooks in AngularJS?1
What is AOT in AngularJS ?,AOT is better than JIT for production ;1
What are directives in AngularJS?1
How to get the parent element of a child element in AngularJS1
Write a unit test for the DataService in AngularJS0
Create a new AngularJS project