Questions tagged [rxjs-observables]
759 questions
-1
votes
2 answers
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> = this.store.select( get it from global…

Scottish Smile
- 455
- 7
- 22
-1
votes
1 answer
Which would be better to use : EventEmitter or service?
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 still emit without such a event in said component)…

BananaTea
- 27
- 4
-1
votes
1 answer
Figure out rxjs marble tests in Angular
I would like to test a service with the help of marble tests.
The basic service looks like this:
interface User {
name: string;
}
@Injectable({
providedIn: 'root',
})
export class ServiceToTest {
public get user$(): Observable

Alex Janßen
- 41
- 5
-1
votes
1 answer
Angular post subscribe never triggering HTTP call
So I have looked into all the different things about how "all you have to do is add .subscribe()" and that is not doing anything, so here is what I have:
private loginPost(username: string, password: string): Observable {
return…

Joshua G
- 2,086
- 3
- 19
- 22
-1
votes
1 answer
I have an array of n number of observable, and i want to make 4 request at a time then again 4, till the end
how do i limit parallel request?
...
for (let offset = 0; offset < file[0].size; offset += chunkSize) {
const chunk = file[0].slice(offset, offset + chunkSize);
const blockId = String(Math.floor(100000 + Math.random() * 900000));
const…

Hammad Khan
- 1
- 2
-1
votes
1 answer
How to call nested dependent API using RXJS
I have 3 APIs.
API 1: returns an object, that object has a GalleryImages field. The Items field is an array of string IDs.
API 2: will use the network string ID from API 1 to call. API 2 returns an object, in the object there is an Items field. The…

quanchinhong
- 142
- 3
- 18
-1
votes
1 answer
OnPush Changedetection for a http service
I want to call a http api and load the data using ChangeDetectionStrategy.OnPush. I know how to go about it using the ChangeDetectorRef by calling detectchanges().
The main component calling the Service is:
ngOnInit() {
…

lopah elision
- 49
- 6
-1
votes
1 answer
How can i write function that trigger/refresh a http post method programatically?
How can i write a method in far far away component,when forexample i click a button and this post method subscribe will run again? I think with a service i should get here...It(this.qwe) has not to be in constructor its just an eaxample...
import…

user19377529
- 15
- 3
-1
votes
1 answer
How handle the error and complete with `tap` operator
Here is my tap operator with next, error and complete, though there is no error always it's called. so my users always empty. how to use the tap operator with correct way?
readonly fetchUsers$ = this.effect(($) =>
$.pipe(
tap(() =>…

3gwebtrain
- 14,640
- 25
- 121
- 247
-1
votes
2 answers
How to wait for API response in the nested subscription before executing next line of code
I have a method that should return me a boolean value, the problem is that this is asynchronus and I want to avoid race condition..
So I have some method for example:
someMethod(data: any): boolean{
let isOccupied = false;
…

D.Zet
- 753
- 3
- 11
- 32
-1
votes
2 answers
Behavior Subject auto load without click issue
There is strange issue I'm encountering at first I try to submit form it succeeds without any issue here is an code excerpt below from page.
userRole.ts:
ngOnInit() {
const userSubscription = this.userManagementService.currentUsersIdValue.pipe(
…
user10668235
-1
votes
3 answers
Auto-initialize BehaviorSubject to cache global data
Simplified use case:
I have Angular app with multiple modules, most (not all) of the modules use a list of airports
I want to create a global-cache.service.ts and cache the airport list in BehaviorSubject which will be exposed as Observable. I only…

roman m
- 26,012
- 31
- 101
- 133
-1
votes
2 answers
How to filter through the post api response and get only the filtered array object from api response in angular?
I have this getSearchBank() post API and this is the response of this api .
This api gives me all the banks which are present in the database
(8) [{…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}]
0: {bankId: '616c07ca9d60c50b84e8b71b', bankName: 'IDBI',…

Kishkin
- 7
- 1
- 5
-1
votes
1 answer
Why can't I access a global property inside the ngOnInit Method?
I am injecting making a basic http request to a online api (randomuser.me), and I want to create an array of 3 objects with the result. I'm trying to subscribe to the observable and create local variables that holds the name and last name of each…

Julio Rodriguez
- 499
- 6
- 16
-1
votes
2 answers
Remove for loop from observable subscribe
this.httpService
.getCustomer(id)
.pipe(
switchMap((customerObj) => this.httpService.getCustomerAccount(customerObj.account_id)),
switchMap((accountObj) =>
…

StaticName
- 239
- 1
- 2
- 10