Sign Up

Sign In

Forget Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

You must login to ask question.

Discy Latest Questions

  • 0

I would like to call f2 after f1 has been completed. f1 function can be synchronous or asynchronous. I need an example that work in both cases. I have found a solution, using a Promise and a timer: global() { this.f1().then(res => { ...

  • 0

I use Observable.forkJoin() to handle the response after both HTTP calls finishes, but if either one of them returns an error, how can I catch that error? Observable.forkJoin( this.http.post<any[]>(URL, jsonBody1, postJson) .map((res) => res), this.http.post<any[]>(URL, jsonBody2, postJson) .map((res) => res) ) .subscribe(res => ...

  • 0

I’m currently evaluating the pros ‘n’ cons of replacing Angular’s resp. RxJS’ Observable with plain Promise so that I can use async and await and get a more intuitive code style. One of our typical scenarios: Load some data within ngOnInit. Using Observables, we do: ngOnInit () { this.service.getData().subscribe(data => { ...

  • 0

I’ve written this function in TypeScript: export class LoginService {async isLoggedIn(): boolean { const r = await this.http.get('http://localhost:3000/api/user/isLoggedIn').toPromise(); return r.body; }}When I try to ...

  • 0

In Angular 2 using rxjs I was trying to convert a Promise to Observable. As many of online guides showed I used fromPromise on Observable. Which throws error: Property 'fromPromise' does not exist on type 'typeof Observable'.Observable was imported like: import { Observable } from ...

close