Skip to main content
Filter by
Sorted by
Tagged with
2 votes
2 answers
44 views

I update a shown value from a subscription, why is my new value not shown? [duplicate]

I have an Angular component that shows a member variable of its TypeScript class. I subscribe to an rxjs Observable to update the value. I see that my rxjs Subscription is executed, but the new value ...
Martijn Dirkse's user avatar
0 votes
1 answer
61 views

How to execute angular http calls in order

I have to make a couple of optional calls to upload files to get ids before I can send a post to a different route with those file ids. const body = ... const updateFile1Reference = map((file: File | ...
lostintranslation's user avatar
1 vote
1 answer
42 views

Value not coming to switchMap operator

I have quite trivial Interceptor that must do the following: Catch HttpResponse. Find there corresponding headers. Make request to the CORS service. Apply JWT token to headers and proceed with ...
andrey.shedko's user avatar
1 vote
2 answers
76 views

Manipulate Observable data prior to subscribe method call

I've been using Angular with RxJS for about a year and a half now. I feel pretty comfortable in most areas, but I'm struggling a bit with RxJS. Several times now I've found myself wanting to ...
commadelimited's user avatar
1 vote
1 answer
35 views

Error object undefined in Angular project built version

I'm handing errors in my Angular app using RxJS like this: public downloadInClient(fileName: string) {     return (source: Observable<Blob>) =>       source.pipe(         map((blob: Blob) =&...
CBD's user avatar
  • 77
3 votes
2 answers
41 views

Angular NGRX test a selection subscription with pipe skip

My method works the way I want it to, however, the test is failing when I add the pipe(skip(1)) How do I test an observable with a pipeable skip. Here is my method: getSomething() { this.store....
John's user avatar
  • 181
2 votes
2 answers
81 views

Using forkJoin for nested API calls

I am struggling to understand the best way to implement nested calls to a API, using forkJoin (without using nested observables). I have three APIs: API to create student (/student/) API to add ...
Ben Halicki's user avatar
0 votes
1 answer
57 views

I am updating the angular component properties inside a if block and I feel it is not updating

ngOnInit() { this.router.events.subscribe(event => { if (event instanceof NavigationEnd) { if (event.url === '/common/time') { this.zone.run(() => { ...
Dwarknight's user avatar
1 vote
1 answer
56 views

Data not being displayed on template but data is fetched

I am trying to display data using rxResource. However, data returned is always undefined. However, inspecting the network tabs shows the data is indeed being fetched and I'm just doing something wrong ...
kibet's user avatar
  • 411
2 votes
1 answer
55 views

How do I return two http requests sequentially in rxjs and use data from first in second call?

I've written a http function that works using switch map to get the value from one http request and use it as a parameter in the second, but how do I return not only the final http request but also ...
bradrice's user avatar
  • 1,797
1 vote
1 answer
91 views

Retry HTTP request

I have Angular service which is used in the Angular pipe. The job of that service is to do a HTTP request and fetch translations. Idea is to have a pipe which returns a Observable that only first ...
AlexBor's user avatar
  • 325
0 votes
1 answer
81 views

How do I set an empty array as default value in toSignal?

I have a DataHandler service that calls a database service and returns the value to the calling component. The database service returns an observable of an array, while I'd like the data handler to ...
Otto Abnormalverbraucher's user avatar
0 votes
3 answers
94 views

Filter observable without triggering HTTP request

I populate a grid with the following line of code: this.gridData$ = this.userService.getUsers(); and this is the corresponding HTML: [kendoGridBinding]="(gridData$ | async)!" It works as ...
derstauner's user avatar
  • 1,924
0 votes
0 answers
65 views

Why is this RxJS subscription never closed?

I have suspected memory leaks and stale RxJS subscriptions for a while in corporate software. I decided to investigate by writing the snippet below. It's very simple. First, it loads RxJS. Second, it ...
Robin Dos Anjos's user avatar
4 votes
1 answer
62 views

Encapsulate behaviorSubject in a service

I would like to hide the "next" interface of a BehaviorSubject while retaining its other properties, especially the possibility to get last emitted value imperatively. The idea is all state ...
Krzysztof Przybylski's user avatar
1 vote
1 answer
75 views

Angular rxjs, multiple subscriptions with subject and mergeMap

I have a service that notifies that an array of categories has been filled (via a call to an API on the bootstrap of the application). As soon as these categories are ready I have to start a call to ...
berno's user avatar
  • 253
1 vote
0 answers
91 views

Auto login with firebase authentication

I'm looking for a great solution for firebase authentication. I use angular with ngrx and firebase. I made authentication with these technologies but when I tried to implement auto login, it actually ...
Kuba Goch's user avatar
0 votes
1 answer
40 views

How to make Jest catch an exception thrown inside an RxJS Observer?

I have a subscription to an observable, which depending on some validations on the emitted value, an exception should occur. This exception is thrown and I can capture it in the application code, but ...
sartoz's user avatar
  • 348
1 vote
1 answer
52 views

Initial value not displayed on mat-select component using async pipe

I'm trying to use a material select component that gets its values through an Observable with async pipe. template: <mat-form-field> <mat-select value="selectedOption$ | async&...
Watttttt's user avatar
2 votes
1 answer
25 views

Why subject's subscriber keeps consume an error, after the first() operator, if the next emit of this subject was called in the inner tap() operator?

I've found a strange rxjs behavior that keeps bothering me, and I can't even imagine a solution to this problem. I need to create an Observable from Subject that will either emit an error if the ...
someApp's user avatar
  • 65
0 votes
0 answers
39 views

Why is "this" still available in rxjs subscription [duplicate]

Looking to the code below @Component({ ..... }) export class AngularComponent { componentVariable: bool; someMethod(){ this.service.subscribe(x => this.componentVariable = x) ...
Massimo Lavermicocca's user avatar
0 votes
0 answers
31 views

OnInit Block with readCSV subscribe/observable function yields inconsistent results

I have an Angular OnInit block inside my "Dashboard.component" that reads a CSV file and populates a web page. If my webpage is called from my "Home.Component" web page, then the ...
MikeLupo's user avatar
1 vote
2 answers
55 views

How To Combine Responses Using RxJS merge() & from()

I have to make n (user defined) http calls. The URLs are generated programatically from user inputs. Each month must be queried separately, so n depends on the date range the user has selected. In the ...
Kiran's user avatar
  • 98
1 vote
3 answers
265 views

How to test Angular's resource() / rxResource()?

I am trying to unittest a service which uses the new rxResource utility, introduced in Angular 19: import { computed, inject, Injectable, signal } from '@angular/core'; import { rxResource } from '@...
fservantdev's user avatar
0 votes
1 answer
52 views

How can I continue refreshing an observable on button click when an observable error occurs in Angular?

I'm working on an Angular application where I fetch data from an API and display it using my custom state pipe and async pipe. There is a button to refresh the API call. However, if an error occurs, ...
Nhut Truong's user avatar
0 votes
0 answers
71 views

rxjs BehaviorSubject returning NULL when queried in React after browser refresh

I need to append the current user to my authHeader so the backend can authorise access to the route called. The code below exposes an rxjs BehaviorSubject to provide the user to any component that ...
DRobinson's user avatar
  • 295
0 votes
1 answer
39 views

How to convert from Observable<T[]> to Observable<T>[]?

Is there a way in RxJS to split an Observable of an array to an array of Observables, one per element?
Mayhew's user avatar
  • 21
2 votes
2 answers
49 views

Signal that an Observable with shareReplay is "stale"

I have a situation with shareReplay(1) . Note that "recalculating" result$ is expensive so I don't want to do it unless required hence I'm using shareReplay(1) in the first place. ...
Christopher Mattiske's user avatar
1 vote
1 answer
41 views

Continue running upon result from modal dialog

The following code is for modal dialog component. I want it to act like "confirm". Running will proceed only after clicking 'yes' (return true) or 'no' (return false) in the dialog. import { ...
Zvi Vered's user avatar
  • 657
2 votes
1 answer
122 views

Angular signalStore and HttpResource

const apiUrl = environment.apiUrl; export const PublisherStore = signalStore( withState(initialState), withComputed(({fetchStatus, saveFetchStatus}) => ({ fetchPending: computed(() => ...
Kino1D's user avatar
  • 21
2 votes
3 answers
49 views

Synchronize call to 2 methods

In a component (or service) I call to Main method which calls to 2 other private methods. export class MyService { private Stage1 (N : number) { console.log ('-->Stage1'); for (...
Zvi Vered's user avatar
  • 657
0 votes
1 answer
24 views

How to add two error handlers to a rxjs pipeline?

I’m given an observable that may either emit values and complete, or error. The observable can be repeated. Consumers of this observable need to be informed if the source errors, but they also should ...
bleistift2's user avatar
1 vote
1 answer
51 views

How to refresh and listen to the refreshed data inside one stream

The important part of my code looks somewhat like this: data$:Observable = this.dataRefresh$.pipe(switchMap(() => this.http.get('url')), shareReplay()); dataRefresh$:Subject = new Subject(); ...
Mirz's user avatar
  • 33
0 votes
0 answers
41 views

How to Cancel Previous API Calls When Updating Query Params in Angular with TanStack Query

I have multiple dropdowns on a page, and each selection updates the query parameters in the URL, triggering an API call via TanStack Query. The issue arises when I change multiple dropdowns quickly: ...
Eternal Sunshine's user avatar
0 votes
1 answer
55 views

foo.subscribe with bar not always working

Imagine we have foo$ and bar$ and both of them are BehaviorSubjects. I have a bug in angular that sometimes in some cases foo$.subscribe(bar$) works fine, in most casses actually. But sometimes I have ...
Muhamed Karajic's user avatar
1 vote
1 answer
69 views

Convert filter pipe to Angular computed signal

I use RxJS filter pipe to trigger data reload from the REST server only when selectedId is not null. How do I transfer the observable into signal/computed signal achieving same effect as with the ...
Dakado's user avatar
  • 163
1 vote
0 answers
40 views

forkJoin([]) requests are being cancelled

I am trying to do parallel requests with forkJoin but sometimes for no reason one of the request is cancelled or one of requests returns 200 but data Failed to load response data . If I make sepratae ...
Sunstrike527's user avatar
1 vote
1 answer
41 views

Angular Query Tanstack Query cleanup logic

I'm using Angular 18 with TanStack Angular Query and have a question about handling observables in the queryFn. In my queryFn, I'm using lastValueFrom() with an HTTP request like this: queryFn: () =&...
Eternal Sunshine's user avatar
1 vote
1 answer
75 views

Http call is running in loop when using async in template

I have a problem and I'm looking for a solution. In a standalone component (Angular 19) with OnPush detection in the template I want to read data from observable: @Component({ selector: 'app-profile'...
TalVik99's user avatar
  • 198
1 vote
1 answer
29 views

Angular Material Autocomplete Data Source Is Observable

I am wanting a drop-down menu that can be filtered. The autocomplete component seems ideal for this, but the example in the docs deals with the scenario where your list is a static array. My list ...
Kiran's user avatar
  • 98
1 vote
2 answers
34 views

Angular NGXS Auth Guard: How to solve Race Condition with User State

I’m experiencing a race condition when using an auth guard with NGXS state management in an Angular application. The guard should check if the user is authenticated and has the required roles before ...
Ilias Bgl's user avatar
2 votes
1 answer
81 views

Sending API's progress updates periodically and saving progress

In my NestJS app, I am trying to work on something that could take anywhere between 10-20 minutes of completion. So, the user clicks on a button and an API is called which does some starts to do its ...
AnAverageDev's user avatar
1 vote
1 answer
95 views

rxMethod on signal store dead after rxjs error

I'm using a ngrx signal store with rxMethod: export const MyStore = signalStore( { providedIn: 'root' }, withState({ loading: false }), withMethods((state) => { const dataService = inject(...
kerosene's user avatar
  • 901
1 vote
1 answer
130 views

Updated signal value is delayed in child component, if the value is passed down as an `input()`

I have a service which maintains some state using a signal. The service also exposes an rxjs observable which emits when a certain event has taken place. This event takes place after the signal value ...
ThePuzzleMaster's user avatar
2 votes
1 answer
32 views

Need to load the data while form get displaying, all the data should be set in the controller, during form load

In the form which values need to be set in controller, those values should be loaded after the spinner , and during form loading ,I have tried to use async and await, but after form get displayed ...
web_in's user avatar
  • 133
2 votes
2 answers
67 views

Waiting for all async requests to complete with concatMap

assuming that there are multiple ajax requests that need to execute one by one sequentially, the next one should be called when the previous is done. I can achieve that by using the concatMap RxJs ...
Semen Shekhovtsov's user avatar
1 vote
1 answer
27 views

http poller using rxjs timer and waitUntil doesn't work

With rxjs 7.5.7, I return a promise when a polling http request will finally returns true after several false values, but takeUntil used is never called again. I tried to following code: return timer(...
magneticcore's user avatar
0 votes
0 answers
23 views

Rxjs subject /behaviour subject emits thrice same value

I m fetching data from api and storing it in rxjs behaviour subject and dataloaded is set/emit to true. On click of button modal opens only once but when I used with tabset ngx-bootstrap modal is ...
Dee's user avatar
  • 193
3 votes
3 answers
73 views

Start multiple independent requests that rely on the same emitted value of another observable

I need to start 3 independent requests in a component that rely on a value emitted by another observable. The first request provides an ID, once that ID is emitted I have to start 3 independent ...
berno's user avatar
  • 253
1 vote
1 answer
88 views

Angular 19 `toObservable` causing `ng build` error TypeError: r.notifier.notify is not a function

The following code: import { toObservable } from '@angular/core/rxjs-interop'; ... export class MyService { readonly myData= signal<MyData| null>(null); // toObservable creates a cold ...
Alex Pappas's user avatar
  • 2,739

1
2 3 4 5
425