Questions tagged [rxjs]

A JavaScript library that uses observables to work with reactive programming that deals with asynchronous data calls, callbacks and event-based programs.

Resources

Related tags

20563 questions
6
votes
1 answer

switchMap does not seem to complete when the inner observable completes

I'm still a noob when it comes to RxJS but here's a JSBin of what I am trying to do. https://jsbin.com/wusalibiyu/1/edit?js,console I have an observable 'a' (in my case it's the current active connection) which emits a new object whenever the…
SpoBo
  • 2,100
  • 2
  • 20
  • 28
6
votes
1 answer

Should we create one Epic per action type? in redux-observable

I am in process of redux-observable learning, and I have some doubts: Should we create an Epic for each action to watch? export const actionEpic = action $ => action$.ofType('ACTION') export const action2Epic = action $ =>…
MatCas
  • 773
  • 8
  • 19
6
votes
2 answers

Angular 2 rxjs nested Observables

I wish to create a function that returns an Observable but before returning another asyncronous task must complete (an Observable), in order for a value to be passed to the returned Observable. @Injectable() export class MyComponent …
gunwin
  • 4,578
  • 5
  • 37
  • 59
6
votes
1 answer

redux-observable epic that doesn't send any new actions

Might be that I'm a noob and not fully understanding how this stuff should work yet, but I have an epic in redux-observable in which I want to use as a way to create a promise which will dispatch an action and wait for a different action before…
Ben
  • 16,124
  • 22
  • 77
  • 122
6
votes
2 answers

Trying to merge multiple observables into one in Angular 2 project

I am trying to get my head around Observables in RxJs. I have a page where I need to display all users for a specific site. User and SiteUser entities are in separate API endpoints. I have the following endpoints userService.getSiteUsers(siteId:…
fenix2222
  • 4,602
  • 4
  • 33
  • 56
6
votes
2 answers

angular2 / RxJS - how to retry from inside subscribe()

this is my code: this._api.getCompanies().subscribe( res => this.companies = JSON.parse(res), exception => {if(this._api.responseErrorProcess(exception)) { // in case this retured TRUE then I need to retry() } } ) in case an exception…
Motassem Kassab
  • 1,744
  • 4
  • 21
  • 40
6
votes
1 answer

Rxjs how to know how many subscribers observable have?

When I have multiple subscribers to one observable, for example: const myInterval = Rx.Observable.interval(500); const subscriptionOne = myInterval.subscribe(val => doSomething()); const subscriptionTwo = myInterval.subscribe(val =>…
user2999287
6
votes
1 answer

How to get the stacktrace of an error when using rxjs?

I'm using angular-cli to build a small angular2 web app and I'm debugging with chrome dev-tools. Clearly I'm doing something wrong if I need to guess each time where is the source of the error and what is the stack-trace of that error. Take for…
Stav Alfi
  • 13,139
  • 23
  • 99
  • 171
6
votes
3 answers

'Subject' is not exported by rxjs in rollup.js

I am trying to set up my project to use rollup, as part of an angular2 move to AOT compilation, however, I am getting the following issue. Error: 'Subject' is not exported by node_modules\rxjs\Subject.js This is my rollup.js file: import rollup…
George Edwards
  • 8,979
  • 20
  • 78
  • 161
6
votes
3 answers

how to check if subscribe is done loading all existing rows?

I want to load all the items on start without showing any message, but once after loaded. I want to capture any new row in subscriber and show it to the desktop notification. The problem is, I'm not sure how to check if all the previous items are…
Basit
  • 16,316
  • 31
  • 93
  • 154
6
votes
1 answer

Unsubscribe observable's promise

How do I unsubscribe an observable if it's converted to promise? I'm using RxJS in Angular 2 import 'rxjs/add/operator/toPromise'; return this.http.get(this.heroesUrl) .toPromise() .then(this.extractData)
Ankush
  • 675
  • 2
  • 13
  • 29
6
votes
2 answers

flatMap missing after upgrading to RC 6 and RxJS Beta 11

After upgrading to RC6 and rxjs@5.0.0-beta.11 I seem to be missing a few extensions from Observable object. flatMap operator is gone, mergeMap is also not here. I only see a few operators now. Any idea what I'm missing?
Yodacheese
  • 4,787
  • 5
  • 34
  • 42
6
votes
1 answer

RxJS the switch function

Could someone please explain what the switch function in RxJS do? I read the documentation but could not configure it out, how it works exactly.
softshipper
  • 32,463
  • 51
  • 192
  • 400
6
votes
1 answer

Angular 2 RC 5 - Observable.interval triggers Change detection

I created a Observable.interval with 500 ms somewhere in my component tree and subscribed to it. The component has no Input or Output properties. That interval triggers change detection starting from the root component each time it sends a tick.…
Normalo
  • 387
  • 4
  • 12
6
votes
1 answer

How to build a true observable collection using RxJS and Angular2?

Let's say I'd like to retrieve a set of records from a store, display them in a list using *ngFor, e.g.
  • ...
Now the user clicks the 'New...' button, another record is…
Thorsten Westheider
  • 10,572
  • 14
  • 55
  • 97
1 2 3
99
100