Questions tagged [rxjs-observables]
759 questions
0
votes
2 answers
How to correctly subscribe Angular HttpClient Observable?
Taking example of HeroService from angular documentation.
Below is a POST method in HeroService
addHero (hero: Hero): Observable {
return this.http.post(this.heroesUrl, hero, httpOptions)
.pipe(
…

Nitish Kumar
- 721
- 1
- 10
- 26
0
votes
1 answer
Call another epic inside one epic RXJS
I'm quite new to RXJS and development in general. I started working with rxjs recently and I found myself stuck with the following issue and I would appreciate some help/ guidance and some explanation please.
export const updateSomethingEpic1 =…

jayd
- 11
- 6
0
votes
2 answers
Property 'map' does not exist on type 'Observable[]>'
I am getting the following error in my services file, suggest the changes in the code:-
Property 'map' does not exist on type 'Observable[]>'.
My Event.ts contains an interface with 5 declared parameters which are id: string; code: string; name:…

user13321892
- 49
- 1
- 5
0
votes
1 answer
behaviour subject and observable in Angular8
I have get rest service data call that is called 3 times. I need to create a data service to reduce the call to once so it keeps a local copy.if the copy hasn't been populated yet, it hits the api to get them. it should do this only once. So, need…

Margerine
- 183
- 1
- 4
- 14
0
votes
3 answers
How to combine two arrays into a single array using RxJs where 2nd array's each element will be assigned to first arrays each object property?
I have two interfaces, they are Team and Company
public interface Team {
id: number;
name: string;
companyId: number;
}
public interface Company {
id: number;
name: string;
}
This is the sample data:
"companies": [
{
"id": 3,
…

Chinmoy Acharjee
- 520
- 5
- 16
0
votes
2 answers
When you subscribe with rxjs, how do you signal to your test if it fails?
I am a complete beginner.
The issue I am having is that once I throw an error in rxjs observable, my test doesn't know about it. When I am subscribing in a test, and it fails within rxjs it just throws an error and I need to notify my test that the…

Daria
- 31
- 4
0
votes
2 answers
Using http client to get a value from server and using it for next steps
I have a function as below where I need to make a call to the server and get a value that the function returns. I am using rxjs subscribe. I get the value but since rxjs is async the function returns before the value is obtained from the server.…

F. K.
- 694
- 3
- 9
- 23
0
votes
1 answer
RXJS/Angular Replace Observable
In an angular interceptor, I want to check wether an auth-token exists. If not, it should be refreshed and the request should be resent.
return next.handle(authReq).pipe(map((result: any) => {
if (result.body && result.body.error) {
if…

L. Männer
- 446
- 2
- 15
0
votes
1 answer
How to run some code in an RxJS chain given there were no errors
I am trying to find a way to run some code only if there was no error in a given rxjs chain. Consider the following, is there something like the artificial NO_ERROR_OCCURED_RUN_HAPPY_PATH_CODE operator in rxjs?
private wrap(obs: Observable):…

ExtraInfo
- 13
- 4
0
votes
1 answer
Importing rxjs modules the right way
I want to import of from rxjs on my Angular 8.2.3 project.
However, I see that this is present in 2 locations -
import { of } from 'rxjs/observable/of';
import { of } from 'rxjs/internal/observable/of';
Which way do I go?

Krishnabm
- 161
- 8
0
votes
3 answers
How to use Observable to emit each value from an array after every 1 second(Angular 5)?
I have a list of Products an array products:Product[]
Using Observable and Observer next method, I want to emit each product to my UI after every 1 second. How can I accomplish this?
This is what I tried , it is producing an infinite loop.Any help…

SijoX
- 77
- 10
0
votes
1 answer
Rxjs finalize after code in subscribtion ends
I have an Angular application (9) and have multiple components that request calculation operations over rest and the displays the result in different editors.
Now before I make the request I call a loading panel and after the request fininished I…

Franki1986
- 1,320
- 1
- 15
- 40
0
votes
1 answer
RxJS: Make a single API request from a function which might have been called multiple times
component controller:
private updateSplitScreenService = () => {
this.splitScreenService.emitNewState(this.products);
this.splitScreenService.emitNewState(this.stores);
};
splitScreenService:
// emitNewState is called multiple times in…

user3406930
- 1
- 2
0
votes
1 answer
Type casting issue in Observable in Angular 8
Hi I am learning Angular 8 and as a learner I have many doubts. I am sharing one of my doubts in detail. I hope some of you can easily help and correct me.
I have a service which consumes to Web API and returns some company details like
0:…

vivek v
- 167
- 1
- 3
- 16
0
votes
1 answer
Why am I receiving the following error when subscribed to the patientAllergies observable?
When I select the add button in the patient-allergies.component.ts, select options for the addition of patient allergies and click save, I receive the following error:
ERROR Error: Error trying to diff '[object Object]'. Only arrays and iterables…

mrrain
- 134
- 1
- 12