Questions tagged [rxjs-observables]

759 questions
2
votes
1 answer

RXJS how to optimize a ForEach in a nested subscribe?

I'm rather new to observables and still learning and i need some help. I have a slider with some campaigns and for each campaign i have a producer which i need get and set to the campaign. I know that using pipe, merge and MergeMap here is probably…
RasmusKW
  • 45
  • 3
2
votes
1 answer

take() with debounceTime() takes the last element only

I am new to RxJS and have a doubt. Below code works fine and prints 'Robert" and 'Mark' let studentNames = ['Robert','Mark','Sam']; from(studentNames).pipe(take(2)).subscribe( data => { console.log(data); }); But…
Ravi Khambhati
  • 637
  • 1
  • 12
  • 35
2
votes
4 answers

How can I increase a value of a ReplaySubject?

I'm using a BehaviourSubject but i'm finding it difficult to increase or decrease that number I'm either creating an infinite loop using: this.observer.pointsCollected$.subscribe(val => this.observer.pointsCollected$.next(val + 10)); Or i'm only…
Ste
  • 591
  • 1
  • 9
  • 20
2
votes
1 answer

Async pipe vs. Subscribe. Why is async pipe version slower?

I've created an app to search employes that use observables. It's very simple: template for subscribe
Kraken
  • 111
  • 11
2
votes
2 answers

Wait in nested observables

I'm new to Observables; I have to convert a nested for loop with Observables and, when a condition is meet, wait for a certain amount of time. I was able to convert the for-loop with Observables, but I don't reach to achieve the "pause" of the flow…
user1
  • 556
  • 2
  • 6
  • 22
2
votes
2 answers

Rxjs observable emit in order

how can i subscribe for example three observables, and to emit when one of them emit new value depend on the order they are, like forkJoin but emit but the order of them is important so if ob3 emit first, i want the value of obv1 to be null, also…
John doe
  • 317
  • 3
  • 5
  • 15
2
votes
2 answers

Better alternative to using concatMap twice within pipe?

I want to execute a pre-defined promise (promise 2) recursively after another promise (promise 1) resolves to see when my connection to a peripheral device returns false, following which I can do something else. I'd like to be able to do so using…
coder101
  • 383
  • 4
  • 21
2
votes
2 answers

Model Binding Property vs BehaviorSubject (For ChangeDetectionStrategy)

I am very undecided whether to use BehaviorSubject to bind data to html. Below are two examples, the First sample binds normally, and the second one binds with "changeDetection: ChangeDetectionStrategy.OnPush" and…
OMANSAK
  • 1,066
  • 1
  • 12
  • 30
2
votes
2 answers

Nest.JS and Observables

I am new to Nest.JS and apparently don't understand how to use observables so hopefully ya'll can help. Basically I have a method that needs to: first: login to hashicorp vault and return a client_token via an http call. second: if we got a token…
Taylor Belk
  • 162
  • 1
  • 16
2
votes
2 answers

Any Scenario(s) that RXJS Observable Subscribe wont trigger either success and error

This is more like question than resolve a problem. I would like to know if there any scenario that both "Success" and Error" is not triggered. The post call to "/logout" will result Http status return code 200 with empty respond body which is…
Zeo
  • 115
  • 1
  • 14
2
votes
1 answer

Loops in RxJS Observable don't stop after calling complete or error

When calling observer.complete() or observer.error() an observer stops sending data and is considered done. However, If there is a for loop in the observer, the loop will continue running even after observer.complete() is called. Can someone explain…
Y.S
  • 23
  • 3
2
votes
2 answers

Using RXJS, is there a way to produce an observable that emits when the number of items, CURRENTLY emitted by the source Observables, is the same?

I have two observables (obs1 and obs2) that I want to pay attention to. They never complete and over their lifetime I can expect that they emit the same number of items. I cannot know which one will emit first. I need something that will emit every…
Jonathan C
  • 23
  • 5
2
votes
1 answer

Angular rxjs data not updating correctly when using share , map & filter

Based on searchCriteria collected from a form, I have a method that return observable of talents. getTalents(searchCriteria) { return this._allUsers$.pipe( tap((talents) => console.log(talents)), map((talents: any) =>…
2
votes
3 answers

Angular - pipe function break execution flow

I have below code: subscriber.pipe( switchMap(data => { this.getData().pipe( map(() => res), catchError(error => { return of(null); }) ); }), …
Naveen
  • 773
  • 3
  • 17
  • 40
2
votes
1 answer

Rxjs Observable array select between given start and end values

I have an Observable array which looks like this: persons$: Observable = new Observable(); private personSource: BehaviorSubject; constructor() { this.personSource = new BehaviorSubject([ new…