Questions tagged [rxjs-subscriptions]

29 questions
0
votes
0 answers

Angular 16 Subscribe to multiple same components not working

I have a component which subscribes to a service. I have placed multiple (4) of it in my view. When the service emits data Only one out of the multiple actually gets it. The rest don't. This is my code: For the service isDark = false; getTheme :…
0
votes
1 answer

How can I ensure that multiple functions in different components only make a single API call using Angular, RxJS, and caching?

i'm using a cache service where i will store the api data in the file like this import { Inject, Injectable } from "@angular/core"; import { Observable, firstValueFrom } from "rxjs"; @Injectable({ providedIn: 'root' }) export class…
saiteja
  • 13
  • 3
0
votes
0 answers

Angular Datatables annoying error in alert

I use this datatable for angular everyone uses. But i get this annoying error in an alert! Who does this?! I have to use dtTrigger, because of the HTML structure. Note, some text is in german. I get the clubs from RXJS with a selector. It's working,…
Jonathan Sigg
  • 306
  • 3
  • 12
0
votes
2 answers

How to navigate to another component after subscription has finished?

I am sending a GET/POST request and wait for the response. After I get the response I would like to navigate to the "patients" page from dashboard page: this.api.getData(body).subscribe((res) => { …
0
votes
2 answers

rxjs observable unsubscribe in CanActivate Guard

I have one stupid question maybe: I'm implementing some routes guards that contains some other observable subscription, they are provided in root, so they should be singleton, no need to unsubscribe really. But what I'm doing is returning all the…
0
votes
1 answer

Trying to Subscribe to a method that returns an Observable in Angular

I have a method that returns an Observable: clockOut(): Observable { let isClockedOut = new Subject(); isClockedOut.next(false); // Some code to clock out and return x if (x === true) { …
n0kx
  • 3
  • 1
0
votes
1 answer

Angular/RxJS: Max number of subscriptions?

I'm creating a directive that formats a date based on the user's timezone. The user has the option to update their timezone via a settings dropdown on the page. Therefore, the directive is subscribing to timezone updates and updating on…
DJDMorrison
  • 1,302
  • 2
  • 17
  • 34
0
votes
0 answers

ObjectUnsuscribedError when navigating to other components - Angular

Hello I'm currently facing a problem with subscriptions when I navigate to another component of the app. The way I handle the subscriptions is on an array. private _subscriptions: Subscription[] = []; and every time I have to subscribe, I push the…
Federico Ribero
  • 309
  • 4
  • 20
0
votes
1 answer

Angular / DataTables: TypeError: Cannot read property 'aDataSort' of undefined with 2 API calls

I've spent several hours trying to sort this issue out and I cannot find an answer that fits my case. Issue I want to display in a DataTable data composed using two API calls. Those calls are performed in a service and the data is then emitted as…
0
votes
1 answer

How to unsubscribe to all the subscriptions on param change in angular

I am developing page which can display job details of a job, for this purpose I am using NGRX store to dispatch actions and subscribing to it to display the data like below this.store.dispatch(new LoadJobDetails(jobIdsObject)); this.subs.add( …
Siva Kumar S
  • 409
  • 1
  • 6
  • 21
0
votes
1 answer

Angular8 RXJS CanDeactivate wait for result of observable before deactivation

I am attempting to use a CanDeactivate guard to detect when a user navigates away from the component. The purpose is to #1 check if the current user owns the 'Is Being Edited' lock on the record, and #2 if so, call an observable to update the…
pengz
  • 2,279
  • 3
  • 48
  • 91
0
votes
1 answer

wrapper observable event on top of http call

I have a function which returns an object. Instead of returning the object synchronously, can I have it returned inside an observable which can be later resolved using callbacks (similar to an http call). Caller Function: getResource() { …
0
votes
0 answers

Rxjs subject with multiple observers with debounce subscribe only the last one

I have an angular v7 application where i am using Rxjs subject. Following is the partial code. I am using the subscription with multiple methods. But only the last subscription is working and not the others. this.userSelectionChangeSubscription =…
Mukil Deepthi
  • 6,072
  • 13
  • 71
  • 156
0
votes
1 answer

How can i fix the nested subscription to work sequential?

I am trying to subscribe multiple times to my own backend. While my code is fetching the data, something seems not to work right. By executing the following code everything is showed as it should be, except of the sequence. So my accounts are…
1
2