this is spot on!

thank you

Regards,
Reza


On Mon, Oct 1, 2018 at 8:50 PM Sander Elias <[email protected]> wrote:

> Hi Rezza,
>
> Will be something like:
>
> import { interval, of } from 'rxjs';
> import { startWith, switchMap, take, takeWhile, tap } from
> 'rxjs/operators';
>
> const post$ = of({ ok: true }); // fake http Post.
> const log = console.log.bind(console);
> // function that returns a fake http get
> const isReady = () => of(Math.random() < 0.5).pipe(startWith(false));
>
> post$
> .pipe(
> switchMap(r => (r.ok ? interval(500) : of(-1))),
> switchMap(r => (r < 0 ? of(false) : isReady())),
> tap(log),
> takeWhile(r => !r), // am I done?
> take(10) // protect me from mistakes.
> )
> .subscribe();
>
>
> Or did I miss something in what you needed?
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Angular and AngularJS discussion" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/angular/jeBO6DeC2VA/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/angular.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to