jeudi 25 octobre 2018

Promise with javascript, how to change it

 getProblems(): Observable<Problem[]> {
 this.httpClient.get('api/v1/problems')
 .toPromise()
 .then((res: any) => {
 // .next: next data
 this._problemSourse.next(res);
 })  
 .catch(this.handleError);
 return this._problemSource.asObservable();
 }

if we don't use promise, how do we achieve the same functionality




Aucun commentaire:

Enregistrer un commentaire