Questions tagged [rxjs]

A JavaScript library that uses observables to work with reactive programming that deals with asynchronous data calls, callbacks and event-based programs.

Filter by
Sorted by
Tagged with
-2 votes
0 answers
21 views

Learning RXJS syntax amd purpose of storeModule.ForRoot() in Angular

I notice the store can get initialized with parameters, but i could not find an explanation of the forRoot command and the usage /purpose of the parameters, apperantly there are multiple ways to load ...
Peter's user avatar
  • 2,071
2 votes
1 answer
12 views

Rxjs combining bufferCount and bufferTime

Using Rxjs, I'm looking for a way to create an observable that buffers N events OR buffer what it can under an interval. After a certain time interval, it emits what has been accumulated till then. ...
Jimish Fotariya's user avatar
-1 votes
1 answer
38 views

How to make filter and map functions work in FormGroup?

I have simple formgroup and two inputs, I want these inputs to filter and map values that I put in them, but it doesn't work. I realise I've made a mistake somewhere, but I'm new to rxjs and I'm ...
jade1411's user avatar
2 votes
3 answers
56 views

Observable reuse after erroring

I discovered, when an Observable errors, it does not emit any values anymore. So how am i supposed to use an Observable, which may error in some cases (containing http call or anything), inside my ...
steffmaster's user avatar
1 vote
2 answers
49 views

unit test : CombineLatest - test succeedes after adding SetTimeOut

I'm trying to test this method: myMethod() { result$ = combineLatest([observableOne$,observableTwo$]); result$.subscribe(([one, two]) => { this.result = one || two; ...
wael jawadi's user avatar
0 votes
1 answer
44 views

API call parameter undefined on initial login

I'm working on a full-stack application using Angular and .NET where I have embedded a Power BI report. In this application, clients have the ability to save bookmarks for a specific page. The ...
Antrhopos's user avatar
-4 votes
1 answer
48 views

Angular get multiple apis and get from selector in combine latest or fork join operator

Issue is multiple times are triggering subscribe method need to avoid such thing. With this all three selector at initial time combine latest called at once. But, the problem is on next time if it ...
ravi0401m's user avatar
0 votes
0 answers
31 views

setInterval slows down in chrome after unsubscribe and re-subscribe

<html> <head> <script src="https://unpkg.com/rxjs@^7/dist/bundles/rxjs.umd.min.js"></script> </head> <body> <script> /*let {interval, take } =...
Balaji's user avatar
  • 201
0 votes
0 answers
26 views

ng-select with async data from a BehaviourSubject stays empty

I'm trying to use <ng-select> to implement a product filter. The filter values (brands) come from an Observable (HTTP request). I'm using a BehaviourSubject that I've bound to the ng-select. And ...
ValLeNain's user avatar
  • 2,257
1 vote
3 answers
63 views

How do you merge(/mergeAll) a Signal of (an array of) Signals in Angular?

In rxjs-land, you can merge multiple Observables with the merge operator. If you have an array of Observables, you simply spread that array into the merge operator, like so: merge(......
Niki Herl's user avatar
  • 340
1 vote
2 answers
67 views

Wait for observables to complete before calling next one

I am using RxJS the following way and I get unexpected values order. The following code can be executed in Stackblitz. EDIT - Simplified code. We could simplify to 2 simple observers to the same ...
Franck's user avatar
  • 13
1 vote
0 answers
23 views

how to populate a field according to the other form fields' values in antd ProForm?

I have created a form using Ant Design ProForm that includes 4 fields. When the user inputs values in the 'Interval', 'Unit', and 'Last Due Date' fields, I want to calculate the value for the 'Next ...
Andish's user avatar
  • 136
1 vote
1 answer
51 views

@Ionic/Angular peer dependency on rxjs conflicts with @ionic-native/core

I have a dependency issue in my @ionic/angular 7.1.1 project. @ionic-native/core latest ver 5.36 appears to have a peer dependency on an rxjs version compatible with 5.5.0 or 6.5.0. I can't install ...
dancingbush's user avatar
  • 2,141
0 votes
1 answer
33 views

RxJs - Combine multiple http request results to a single object

This is my first assistant call, so pls excuse me if I get some protocols wrong. I can't seem to get this right. I'm trying to loop over an array of urls get the result and add the result as a value ...
Egon's user avatar
  • 31
-1 votes
1 answer
43 views

Promises and Observables - intermediate methods

I have a service that I want to build an abstraction over. The service returns Observable<DataAlert>, and I want to basically "pass" that on, while making a separate call to a ...
Dominic Shaw's user avatar
1 vote
1 answer
28 views

How to Reset/Reload/Refresh?call Again a toSignal() / Observable Stream with updated data in Angular?

I have an Angular application using a library's toSignal() function to create a signal from an Observable stream. Here's my code snippet: public_timeline$ = this.stream_service .readProfileFeed('...
syahiruddin's user avatar
0 votes
1 answer
40 views

How to track error, count it and send it to Google Analytics

I've an interceptor that redirects to route /page-error on every api error return next.handle(request.clone()).pipe( catchError((err: any) => { this.router.navigate(['/page-error']...
carlos's user avatar
  • 601
0 votes
1 answer
30 views

How to subscribe to an Observable with three different filter conditions

I'm seeing this code, which seems non-compliant to me. I mean, three different subscribes to the same observable in order to handle three filter conditions? My question is: what's the best way of ...
bob.mazzo's user avatar
  • 5,223
0 votes
2 answers
28 views

concat operator evaluates requests' payloads before executing them

I'm working on an Angular app (Angular 16.2.0, RxJS 7.8.0). I have 3 HTTP requests I need to execute in a specific order. I looked at the official RxJS website and decided to go with concat. I put my ...
naikicoul's user avatar
2 votes
1 answer
35 views

Angular - Stream multiple HTTP calls 2 per 2

I have an array of payload elements: [1,2,3,4]. I would like to stream the payload over multiple HTTP calls, 2 HTTP calls simultaneously. Fire the first 2 HTTP calls, the first one with paylaodElement[...
Mouad Ennaciri's user avatar
0 votes
1 answer
23 views

How do you make an async request inside a CanDeactivateFn guard in Angular?

Maybe a weird question but I've been having issues solving issues with this for a bit. I have this function, which is really just an custom Alert Window that might or might not get called if a user ...
Rui's user avatar
  • 73
0 votes
0 answers
27 views

Re-render is not triggered after redux state gets updated

I'm using redux-observable and I'm trying to get events after update events action is finished. update-events.js import { mergeMap, switchMap, from } from 'rxjs/operators'; import { ofType } from '...
Shotiko Topchishvili's user avatar
0 votes
1 answer
32 views

Trigger BehaviorSubject with same value after Mutation

I have an BehaviorSubject on which I have changes via mutation (don't ask why, but sadly there is no other options to change the values). I want to trigger the BehaviorSubject for subscriptions on the ...
andy's user avatar
  • 23
1 vote
1 answer
26 views

RxJS: exhaustMap in V8

According to the document the exhaustMap uses an ResultSelector and this will be removed in V8. I tried to follow the example but couldn't make a clue how to refactor my code. interval(5000) .pipe( ...
LeO's user avatar
  • 4,260
1 vote
1 answer
38 views

What is the difference between connecting the subject a the observable at first and at last as both of them are asynchronous?

I have a code where I am trying to connect a subject to an interval observable: const subject = new Subject(); // Connect the subject to the observable interval(1000).subscribe(subject); //**Line ...
Jewel Chakraborty's user avatar
0 votes
1 answer
38 views

RXJS Observable, with a dynamic function pipe

I'm trying to return an observable with a pipe that gets populated every time it gets called. To demonstrate what exactly this means, look at the example below: const myObservable = timer(1000); ...
Al00X's user avatar
  • 1,494
0 votes
1 answer
69 views

BehaviourSubject is not re-rendering my template

After a couple of days trying different things, the time has come to ask the question at the community. I am trying to re-render a template in Angular after clicking/selecting a cluster pointer on an ...
Vanonckelen Dieter's user avatar
0 votes
0 answers
43 views

Use switchMap operator in a resolver

I want to only navigate to the product detail page if the product exists so I created this productResolver function export const productResolver: ResolveFn<Product | undefined> = ( route: ...
Othmane's user avatar
  • 153
-2 votes
1 answer
26 views

RxJS pipes undefined

I'm running a json-server database with some random data: { "status": [ { "id": 3, "uid": 1, "isActive": false ...
Mlouden's user avatar
  • 47
0 votes
1 answer
38 views

How to use expand operator to get all data from api call

I have a service that calls my api: this.service .getData(params, currParams.Id) .subscribe({ next: (data) => { this.handleData(data); this....
GustaMan9000's user avatar
1 vote
1 answer
32 views

Should I be using a service method (which relies on an observable) to do calculations in a component?

This is a pattern I frequently find myself in and I'm not sure why or what the right way to achieve my goals is. I need a number value which many calculations are dependent upon, but this value needs ...
jameseg's user avatar
  • 752
0 votes
1 answer
34 views

switchMap in catchError executes only the first time

I have a Redux store with some rxjs operators in Angular. In it, I have an Observable that fetches data from a server. The Observable has a catchError. The first console.log in this catchError logs at ...
escplat12's user avatar
  • 2,203
1 vote
3 answers
71 views

I need an Angular Observable returning single value but without initial value

I need something like an Observable that calls a webservice exactly once, and return its result to all subscribers. Subscriptions may happen before or after the call. How can I do that? A Subject will ...
luca.vercelli's user avatar
0 votes
1 answer
36 views

Handle Promise in Obversable for Angular HTTP Interceptor failes

I am facing the following sitatuon: I have an authentication service, base on angular/fire with firebase authentication. The authentication service should return the id token with the idToken ...
unos_mopsus's user avatar
0 votes
1 answer
22 views

How to check http status in a rxjs/expand inside a Angular resolver?

I need to check the status code on a GET request. If that GET request has a status of 204, then I need to call another api. This is in a resolver which is being used as a data guard in the Angular ...
dman's user avatar
  • 10.4k
0 votes
1 answer
41 views

Issue with uploading multiple files Angular

I've been trying to upload multiple files to Firebase Storage in my Angular application. However, I've encountered an issue. When I upload a single file, everything works fine. It uploads the image to ...
Arkadian's user avatar
1 vote
1 answer
34 views

How do I let ag-Grid events read private methods?

I want to make my ag-grid dynamically resize as the window width is changed as well as to destroy the FromEvent when the user leaves. import { Component, Input, OnDestroy, OnInit, ViewChild } from '@...
Francois Robbertze's user avatar
0 votes
0 answers
23 views

Do I need to unsubscribe if subject and observer are in the same instance?

Imagine a simple use case where : class Foo { valueChange$: Subject<any>; constructor() { this.valueChange$ = new Subject(); this.valueChange$.subscribe((value) => { ...
Bobin44's user avatar
0 votes
1 answer
43 views

typescript error "Not all code paths return a value." when i try to manipulate response and return, but direct return response works fine

i have a situation where i try to manipulate/process response and return but then I get error from typescript Not all code paths return a value. Im fetching the data from a backend API using RxJS ...
binga58's user avatar
  • 137
0 votes
1 answer
34 views

Dynamically filter array based on async user input and content of another array

I want to display a filtered list of strings for display to the user where the filter is a function of input from the user and another (dynamically changing) array which contains strings that should ...
Moritz's user avatar
  • 50
0 votes
1 answer
50 views

Using switchMap to trigger repeated HTTP requests on state changes

I'm working on an Angular project where I'm trying to trigger an HTTP request every time the state of a hot observable changes and subscribe to all of these changes using the switchMap operator. ...
Josu Vázquez's user avatar
0 votes
1 answer
37 views

Generic mapping function where type T & Q have the same keys but different property types

I am looking to create a reusable RxJS operator that can map from object T to Q. This will be used to convert dates formats. T & Q are therefore different types but only in regard to the ...
Sam's user avatar
  • 1,763
0 votes
1 answer
30 views

Angular pass result of observable through pipe

I am trying to combine few observables and passing the value from first one through the entire pipe. this.auth.user .pipe( switchMap((authUser) => { if (!authUser) { ...
Radu Hatos's user avatar
2 votes
2 answers
33 views

error in distinctUntilChaned if no comparer function provided

given this code: /** * Create a stream from an array of car objects. */ from([ { name: 'Porsche', model: '911' }, { name: 'Porsche', model: '911' }, { name: 'Ferrari', model: 'F40' } ]).pipe( ...
derstauner's user avatar
  • 1,548
1 vote
1 answer
41 views

RxJs retry on "outer" observable

I have a Component Store that is calling an api endpoint. Sometimes, the payload can become quite lengthy and the response fails because the url is too long. There's a lot of different scenarios that ...
mwilson's user avatar
  • 12.4k
0 votes
1 answer
27 views

Angular-RxJs-Testing-Prevent nested catchError from being executed

I want to test an http error interceptor case where next handle throws initially an error and the nested observable emits a value. The problem is that although 'switchMap's' code is executed as it is ...
tsiro's user avatar
  • 2,333
0 votes
0 answers
23 views

Json Schema Form

I am using Json Schema Form to render the UI in my ReactTs project. I was playing around with their playground and everything is working as expected. But when I am using the same schema into my app, ...
Georgiana's user avatar
  • 127
0 votes
1 answer
68 views

What version of rxjs is compatible with both Angular 16 and ngx-chips 3.0.0?

There are some issues of ngx-chips with angular 16. As of the current migration I am doing ngx-chips doesn't support rxjs 7.4 and with 6.5.3 it throws a build error Error: export 'filter' (imported as ...
Mayank Dargan's user avatar
0 votes
1 answer
20 views

RxJS fromEvent target type issue (Angular 13)

When working with fromEvent and ViewChild I receive the following error in the terminal: The last overload gave the following error. Argument of type  ElementRef | undefined  is not assignable to ...
seguraMode's user avatar
0 votes
1 answer
49 views

How to cancel all previous requests except the last one using NestJS and rxjs?

Imagine a situation where a complex request is being processed on the server. But the user can click on the button any number of times and send requests. I wanted to cancel all the old requests on ...
Fydor Zbinyakov's user avatar

1
2 3 4 5
413