Questions tagged [rxjs-observables]

759 questions
1
vote
2 answers

Subscribe to all control values within an dynamic array of controls

I have a dynamic array of ng-select controls. Each control represented by class NgSelectComponent. When select value changes I want to subscribe to all controls. Template
Sergino
  • 10,128
  • 30
  • 98
  • 159
1
vote
1 answer

How to synchronise rxjs observables

I'm looking for a way to make streams that are combined Note: this is the simplest form of my problem, in reality I'm combining 8 different streams some are intertwined, some are async etc :( import { BehaviorSubject, map, combineLatest } from…
Jason Rogers
  • 19,194
  • 27
  • 79
  • 112
1
vote
1 answer

RXJS, how to change the result of each result from an observable?

I have this reloadProducts function that i use to reload the products i have in my cart. I have 2 models, one is CartProduct and the other a Product. The CartProduct has a name which i use with a function from my service, to get the matching…
1
vote
1 answer

How to use LOGICAL OR Operator on Observable Boolean in Angular/RxJS

I am trying to do the logical OR/AND operator on two observable Boolean values. I looked around a little and found on some old questions that combineLatest could be used for that, but it seems unfortunately it is deprecated now, and I can't find any…
Rishabh Agrawal
  • 101
  • 1
  • 1
  • 8
1
vote
2 answers

How to cancel previous http request when type in search bar

I want to add some delay in making network request when I type in search bar. So I can prevent unnecessary network request. header.component.ts searchProduct(event: KeyboardEvent) { if (event) { const { value } = event.target as…
1
vote
1 answer

Angular version 14: map() inside pipe() to obtain a sub-array

Currently i'm refactorizing a web app which consists on a website which shows the Golden State Warriors Roster and more specific info about the NBA basketball players if i click on the player's image. I get the data located on a JSON Server/JSON…
1
vote
1 answer

return Eventsource Observable from Server sent event in angular

I have a Observable from a server sent event which returns data und errors using the following solution Allow creation of Observable from EventSource (server-sent events): enhancement To solve connection issues I want to separate the const…
Sator
  • 636
  • 4
  • 13
  • 34
1
vote
1 answer

Angular async pipe doesn't subscribe

In Angular (v12) I've got the component you can see below: component.html

{{ userInfo.user.name }}

Loading... component.ts token:…
Igor Cantele
  • 387
  • 1
  • 10
1
vote
1 answer

How do I test an observable inside mergeMap when outer observable uses FileReader

I'm trying to test a file upload. I wrapped the FileReader() into an observable according to this thread: onFileSelected(event: any) { this.importJsonFileToString(event.target.files[0]) .pipe( map(jsonString =>…
Waffel
  • 11
  • 3
1
vote
1 answer

How can I combine 2 observable that return success result event if one of them was failed?

I want to subscribe to two observables methods but one might get an error and the second may success. But when I try to do it I get only error event if one of them return success when I'm using combineLatest I get only error even if the first is…
Ortal Blumenfeld Lagziel
  • 2,415
  • 3
  • 23
  • 33
1
vote
1 answer

Why these RxJS operators are not running in my function?

I wrote a function to check if a div should be displayed, like this : shouldShowDiscount() { console.log('shouldShowDiscount'); return this.baseSiteService.getActive().pipe( switchMap( (bucode, index) => { …
João Pedro
  • 794
  • 2
  • 12
  • 28
1
vote
0 answers

Angular: rxjs observables: Code in subscribe function not executed

I'm subscribing to an observable my service returns. The request to the backend works and I get a response. But the code inside the subscribe function is ignored. I get the observable from the service like this: my function() { return…
sgart
  • 76
  • 6
1
vote
0 answers

In RxJs, what are the examples of Hot and Cold Observable operators?

Is there a list to differentiate them? I have tried using some of them and was thinking if there is a list for me to check whether I am using the Hot or Cold Observable operator.
Eli
  • 9
  • 3
1
vote
0 answers

How to chain serial operations with observables using the rxjs concatMap operator

I am trying to perform a series of chained operations on a database where the starting point is a set of entities that I loop through and for each one I have to execute 3 calls to a service that accesses the database estudiarConcursos()…
1
vote
1 answer

Join multiple http calls that can happen conditionally in one observable

For the sake of the example lets say I have a entity called client: interface Client { id: number name: string address: Address[] } interface Address { id: number street: string } In this case I cannot update the name of client and…