As of May 31, 2023, we have updated our Code of Conduct.

Questions tagged [rxjs-observables]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
1 answer
18 views

How can I access data inside ngOnInit in Angular?

I am using subscribe to get data inside ngOnInit. I want to do some operation based on the value received from it. But when I am trying to access it in ngOnInit, it is undefined. My class : export ...
Prerna Garg's user avatar
1 vote
1 answer
36 views

ConcatMap with CombineLatest creating more calls than expected

I have an ngrx action/effect that takes a FileList and uploads them sequentially to the server. After the first File is uploaded, an ID will be generated that needs to be used by the second File as ...
Luis Lavieri's user avatar
  • 4,044
0 votes
0 answers
36 views

Why are my Declarative RxJS async pipe calls (success/error) showing simultaneously in my HTML?

I have two declarative RxJS calls (with an action stream) that are separate and get passed to an output component in order to be displayed in the HTML. So once I hit a button, the body from our form ...
Donald Groezinger's user avatar
0 votes
1 answer
33 views

Fanning out and summing results in RxJS

The below is a mockup of something I'm trying to achieve in RxJS (summing resource counts by compliance status). It works, but is there a simpler way to write this? const { combineLatest, of, map, ...
Kit Peters's user avatar
  • 2,139
0 votes
1 answer
17 views

get the current time until next repeat with rxjs repeat

I have an angular app using rxjs to hit an api endpoint every 10 seconds for updates and stops after 10 times. It's working fine: public checkAPI(): Observable<MyData> { return this.http ....
Bob Ramsey's user avatar
1 vote
1 answer
87 views

RXJS observers slow down each other

I have the page with the documents list on the left (with clickable items, each items will select a document), and the actual content of the selected document in the right side, which takes up the ...
Vladimir Despotovic's user avatar
-1 votes
2 answers
55 views

Angular RXJS optimize nested subscribes

Hey there I've an update function call with nested subscribe, interdependent, just that on the success of the parent call subscribe the inner one updateSelectedScopes() { let params: any = { ...
Mitul Panchal's user avatar
1 vote
1 answer
37 views

How do I resubmit an action stream observable after a failed attempt in Angular/RxJS?

Please ignore variable names and formatting as I've just changed them. I've been trying to implement RxJS error handling for an observable that takes an action (user click) and then sends the request ...
Donald Groezinger's user avatar
-1 votes
2 answers
26 views

Populating Global Array from Angular Observable

In my Angular13 component I have an observable sending out a stream of data. I want to do some data manipulation of this data outside of the Observable. myObservable$: Observable<ReadonlyArray&...
Scottish Smile's user avatar
0 votes
0 answers
40 views

Where should I put the catchError operator for higher-order observables?

To make api calls in order I'm using the concatMap operator and it works great. Now I need to handle the errors on the outer and inner observables individually. This is what I've come up with so far ...
eddy's user avatar
  • 4,323
0 votes
0 answers
22 views

ng build giving error related to Rxjs module

While doing ng build, I am encountering some module error related to RxJs. Here is my package.json file "dependencies": { "@angular-slider/ngx-slider": "^2.0.3", ...
manish_jsohi_1996's user avatar
0 votes
1 answer
19 views

How to: Rxjs Observable Process values in order (concatMap), handling errors(catchError), without 'stopping' (switchmap)

Goal: Process(async Call) all elements from Observable in order, finishing one before the next (concatMap style) while handling errors from bad elements without stopping. It is understood that an ...
redevill's user avatar
  • 301
0 votes
1 answer
60 views

GroupBy or Reduce on Array of Objects Observable

I'm using Angular 14. I have an Observable that is an Array of Objects, looks like a dictionary with key/values. Array: [ 0: Object {id: 100, manufacturer: 'ford', model: 'mustang'}, 1: Object {id:...
Scottish Smile's user avatar
0 votes
2 answers
50 views

Run an API multiple times and store the result in an array

I want to run an API call multiple times and then store the API response in an array/observable. public getProgramNamesList() { for (let i = 0; i < this.totalPages; i++) { ...
Shashikumar N's user avatar
1 vote
1 answer
41 views

Type 'Subscription' is missing the following properties from type 'Observable<EnumValue[]>' : source, operator, lift, subscribe, and 3 more

Have issues assigning an Observable<EnumValue[]> to Observable<EnumValue[]>. fetchContactLocationStates() { this.contactLocationStates$ = this.enumValues$ .pipe(takeUntil(this....
CorrieJanse's user avatar
  • 2,346
0 votes
1 answer
31 views

RxJs: How to force execution of an unsubscribed observable

I am trying to create a TypeScript function that returns an observable, but I want it to execute its full set of pipe functionality, without always requiring the caller to subscribe to it. My goal is ...
Tim Coulter's user avatar
  • 8,685
0 votes
4 answers
96 views

Queue of requests with shared results in RxJS

I have a service with an Observable which queries an array of objects from a server and then share-replays it until it is updated. If another service/component needs one or more specific objects it ...
Xriuk's user avatar
  • 431
1 vote
1 answer
44 views

Subscribe to observable returns undefined

So I have a service that uses a dictionary to store HTTP responses (maps an id to a specific URL). import { HttpClient} from '@angular/common/http'; import { Injectable } from '@angular/core'; import {...
inquisitivemongoose's user avatar
0 votes
1 answer
71 views

Store Data out from Angular Observable

I wanted to store the data from the angular observable method. I'm checking one condition where if the parameter value that is email is same as the data I'm retrieving from the backend then the ...
Avinash Kumar's user avatar
0 votes
1 answer
38 views

RxJS replay last message with uniquekey

I have a stream of events of multiple types. On a new subscription, I'd like to repeat the latest event for each type (the only one), and then continue with any new events. Say I have an event for: ...
Ákos Vandra-Meyer's user avatar
0 votes
0 answers
24 views

pipe+map used instead of subscribe in rxjs

When calling the store (and in several others occasions), my project team is using ad nauseam the following pattern to update the store from an observable this.fetchAllItems().pipe( map((...
Aldian's user avatar
  • 2,562
0 votes
0 answers
42 views

How to populate observable data for Angular Kendo Grid Export to Excel button?

I have component with Kendo grid on it, which is populated with the products. I'm trying to convert "static" StackBlitz example to reactive, and struggle to write proper code for allData$ (...
sam sergiy klok's user avatar
0 votes
0 answers
39 views

I got ts httpClient error with Observable rxjs

error: Type 'import("/Users/naym/Documents/pets/angular-nest-todo/node_modules/rxjs/internal/Observable").Observable<{ token: string; }>' is not assignable to type 'import("/Users/...
Дима Науменко's user avatar
1 vote
3 answers
107 views

How to use an Angular service inside an RXJS Custom Operator?

How do I use an Angular service in my custom rxjs operator? Is it possible to do this? function myOperator() { return function <T>(source: Observable<T>): Observable<T> { ...
Bogmag's user avatar
  • 49
2 votes
1 answer
94 views

RXJS SwitchMap not working properly with Resolver after Angular Upgrade

I have a component where a user chooses a report type to generate. The component.ts function is like so: generateReport(reportType, projectReport) { this.showSpinner = true; if(reportType === '...
Tom O'Brien's user avatar
  • 1,701
0 votes
2 answers
127 views

Angular error TS2305: Module '"rxjs"' has no exported member 'tap'

I'm adding RxJS into Angular app. After installing RxJS, I got errors: error TS2305: Module '"rxjs"' has no exported member 'tap'. for the line of code: import { catchError, tap } from "...
sam sergiy klok's user avatar
1 vote
0 answers
101 views

RXJS subject take the first value on every changes?

I have an event and it will emit the event for 1 and/or 2 times, depending on the selection. Every time I am trying to capture the first event. Below is my html code <custom-dropdown (customClick)=&...
mkHun's user avatar
  • 5,861
1 vote
1 answer
39 views

Does this RxJS observable mapping construction prevent memory leaks?

I'm working on a project that uses Angular and by extension RxJS as well as the NGXS store management. I'm loading some values through selectors to a component and want to decide whether to use just a ...
Heribert Greinix's user avatar
0 votes
2 answers
101 views

How to set an external variable from Angular RxJS map method?

I'm attempting to convert some code to be reactive/declarative using the async pipe to update the template. One of thing things I'm struggling with is setting a variable that was previously set in ...
Modern Viking's user avatar
0 votes
1 answer
196 views

Angular 15 create observable function referencing local variables

The observable function is NOT http; the function must be local, but it needs to be subscribed. This is the best I could do based on online example: export class AppComponent implements OnInit { ...
Yogi Bear's user avatar
  • 923
2 votes
1 answer
40 views

How to replicate a promise chain in Angular using Observable?

I'm new to angular and migrating a project from angularJS to angular. I'm having below issue with the existing flow. 1.authcomponent: function FuncBasedOnLogin() { authServices.hasLoggedIn(...
dhanush shetty's user avatar
0 votes
1 answer
96 views

Is using takeUntil() more preferable than unsubscribe() in Angular?

I've been researching the topic regarding unsubscribing in Angular(Observables/RxJs), where there are several ways to do that: takeUntil/takeWhile/unsubscribe. And based on my observations, most of ...
Artsiom Krukouski's user avatar
0 votes
1 answer
43 views

How to change/cast Observable<String> to Observable<String[]>

I am trying to use the async pipe with an observable in my receiving component so that I don't need to use OnDestroy (b/c the async pipe automatically subscribes and unsubscribes for me) In order to ...
ThomasRones's user avatar
0 votes
0 answers
19 views

Input field ignore observable and filtered RxJS value after manual input

I'm having input text box which is subscribe to router change, and should change if certain route came through filter. I does work once. After I change text value manually, it never changes again. Why ...
sam sergiy klok's user avatar
0 votes
2 answers
225 views

How to reactively subscribe to URL change and get URL in Angular RxJS?

I have application with routing, which changes by buttons click (see screen below). I'm trying to get URL into text box every time it's changes. How to do it? So far I been able to attach to ...
sam sergiy klok's user avatar
1 vote
1 answer
311 views

How to subscribe to ActivatedRoute change event and get URL and params from it?

I'm trying to clear input text by pressing buttons which send routing event. So, if I'm getting specific route and no parameters (see green buttons on screen below), then text box should be cleared. ...
sam sergiy klok's user avatar
0 votes
1 answer
74 views

Modify the rxjs Observer to make another API request and return the same observer

I am making a HTTP request in Angular service which is returning the observable of this kind : var response = of({ status: "success", rings: [ { pIds: [1, 2], pNames: [] }, { ...
shashank's user avatar
0 votes
0 answers
159 views

R3InjectorError(Standalone[App])[HTMLElement NullInjectorError: No provider for HTMLElement

I'm getting console error when I'm trying to create variable to access button (HTMLElement). I tried it as a constant or in the constructor. Why and how to fix it? FYI: In this application I'm trying ...
sam sergiy klok's user avatar
0 votes
1 answer
28 views

can I call the apis in observable in a certain sequence/order

I am learning angular Observable topic. I was trying to call apis inside Observable and hoping that they will run in an order in which I have stated them. Below is my component class code: import { ...
J. Doe's user avatar
  • 57
1 vote
1 answer
91 views

How to access an array property from a class wrapped inside observable in angular?

I am trying to populate a dropdown by accessing an array property from the class which is wrapped inside an observable. I have an interface like below : export interface ...
ILoveStackoverflow's user avatar
0 votes
0 answers
40 views

I can't get the information outside of subscribe section with Observable and HttpClient in Angular

My backend is working, but in the frontend I have the service: getDoctorById(sId : number): Observable<Doctor>{ let url = this.baseURL+"/id/"+sId return this.httpClient.get<Doctor&...
Laura Ruiz's user avatar
0 votes
1 answer
42 views

How to take some of the properties of an Observable and assign them to another Observable using RxJS operators

I have an employee$ Observable and a personalInformation$ Observable. personalInformation$ is a subset of employee$ and I want to map the matching properties of employee$ to personalInformation$. The ...
eleon's user avatar
  • 173
1 vote
2 answers
36 views

Is it possible to write an rxjs operator that controls subscription to it's source?

Let's say I have an observable source that has the following properties: It makes a network request the first time it's subscribed to It's idempotent, so it will always emit the same value after it'...
Finley Baker's user avatar
0 votes
1 answer
33 views

Observable is always undefined when transform the value using map

I'm trying to understand why when I transform the observable it comes up undefined in the console log even though I know it has values assigned to it. Http Request getLibraryCardPeople(bookName: ...
BananaTea's user avatar
0 votes
1 answer
72 views

Enrich RxJS observable result array with data from another request

Considering the following simplified data structure: Teacher { id: number, name: string students?: Student[] // filled with an inner second request } Student { name: string } TeachersResult (...
Christopher's user avatar
1 vote
3 answers
203 views

Toggling value of behavior subject without using getValue

I want to toggle the boolean value of my behavior subject. I'm currently achieving this by using the Behavior Subject's getValue() method. This isn't ideal as I'm effectively taking my reactive, ...
Pablo52's user avatar
  • 39
1 vote
1 answer
118 views

How to call 2 observables based on an input from form field (Angular) and only subscribe once

I have the following scenario. there is a form control like get cars(): FormControl { return this.parentForm?.get('cars') as FormControl; } I want to subscribe to a service getAttributes() using the ...
RDK's user avatar
  • 39
1 vote
3 answers
109 views

Rxjs stream of arrays to a single value and repeat at the end of the stream

I have an observable that fetches an array of items (32 each time) from an API and emits a new response until there are no items left to fetch. I want to process said list of items one by one as soon ...
Jose Andres Montes Espinoza's user avatar
0 votes
1 answer
35 views

call two different methods based on emissions of two observables

currently, I have a cabinet with some drawers, each drawer has some items that users can manipulate. Whenever the user switches to a different drawer an observable (D) fires. As soon as the user ...
techi's user avatar
  • 73
-1 votes
1 answer
125 views

Which would be better to use : EventEmitter or service? [closed]

I'm learning angular framework and I was wondering in this scenario which would be better to use. Child component gets 3 inputs ( name, date, age) but has no click event ( From what I gather you can ...
BananaTea's user avatar

1
2 3 4 5
15