Skip to content
Advertisement

Tag: rxjs

capture error from catchError – http.post

component which is calling submitUser Here is the service file with submitUser function and here is the httpService Post and handleError methods handleError adisplays the console error, I am trying to return/capture this error in my submitUser function in service.ts How do i do that ? Any Inputs appreciated, Thanks Answer Your handleError() method returns an error observable along with

How to access array elements in angular

From an API, I’m trying to get data using httpModule. Here is my code When I use async and await, it says that await has no effect. An undefined is getting assigned to the variable this.output. How can I make this work? Also, How can I get access to a variable from the below response array? here I need to

how to run subscribe sequentially in observable

I want to run code sequentially but I was wondering how this works, for example, I have a method that includes two observable and some fields. I want to run the first observable completely then the next field values check and after that the last observable method: but at the current stage step 2 completed first and step 3 next

RXJS – return observable value when doing a map

I have an array of inputIds where I am doing a map that returns a name and value object. Inside the map, I am calling this.inputService.getInputFieldObject which returns an Observable<InputValue>. How do I return the value of the subscription instead of returning an array of subscription values? So I could have attributes returned as an array with only name and

Select ReplaySubject values emitted untill now

Is there reliable solution to get a snapshot of values currently buffered in ReplaySubject? I came up with something like this, but not sure how reliable this solution is: The timer factor above seems wrong to me as I have no warranty if all values have been emitted properly within given time (this applies to replay subjects with a lot

How to subscribe to date chage with Rxjs

I couldn’t find a “simple” example with Rxjs, demonstrating how we can listen to days changes as an event. for example, let’s say that I have to execute certain methods every time we enter a new day. how can I approach this with the reactive paradigm and subscribe to time events? Answer I have solved this by creating an observable

Subject call to next causing a strange error

This causes the following error: Cannot read property ‘length’ of undefined If, however, I wrap msg$.next in a function, then it works without any errors. Lambda function Anonymous function Named function They’re all just wrapper functions that seemingly do nothing but call the next function. What’s going on here? Seems like there’s a JavaScript gotcha I’m not aware of at

Advertisement