Example #1
0
export function promiseResult(observable: Observable<any>, self: Object): Promise<any> {
  return observable.toPromise()
    .then(response => {
      if (!response._body) return null;

      return response.json();
    })
    .then(result => {
      handleResponse(result);

      return result;
    })
    .catch(handleError.bind(self));
}
Example #2
0
 sendResponse() : Return {
   return {
     $promise: this._request.toPromise().catch((e:any)=>console.error(e)),
     $observables: this._request
   }
 }