Questions tagged [observable]

An observable is typically a programming construct that can be "watched" by other parts of the code, called the "observers". Different frameworks and programming languages have different implementations for observables, so this tag should typically be used in conjunction with others.

An observable is typically a programming construct that can be "watched" by other parts of the code, called the "observers". Different frameworks and programming languages have different implementations for observables, so this tag should typically be used in conjunction with others.

An observer may be any object that implements interface Observer. An observable object can have one or more observers. After an observable instance changes, an application calling the Observable's “notification” method causes all of its observers to be notified of the change by a call to their update method.

References

9527 questions
3
votes
1 answer

ionic2 InAppBrowser (Ionic native) loaderror not working

If there is a network connection but if internet is not working . example There is a wifi connection but wifi doesn't have internet connection than the browser observable should fire "loaderror" event. Code: import { Component } from…
jack_07
  • 177
  • 13
3
votes
1 answer

Angular2 http request in an interval

I m trying to make a request every 3 seconds and print out the response but until now no luck :( . I m pretty new to the Observables, so what am I doing wrong ? checkConnection() { const URL = "https://www.google.at/"; Observable.interval(3000) …
tlq
  • 887
  • 4
  • 10
  • 21
3
votes
1 answer

RxJS Approach leads to Callback Hell

I would like to use ReactiveJS Observable method for the below use case. IF MAIN_CACHE EXIST RETURN OUTPUT ELSE IF DB CONNECTION EXIST CACHE MAIN_CACHE (1 Hour) CACHE FALLBACK_CACHE (3 Days) RETURN OUTPUT ELSE IF FALLBACK_CACHE EXIST …
Alamelu Venkat
  • 471
  • 1
  • 4
  • 15
3
votes
1 answer

Angular 2 - No response sending objects to a component with an Observable service

I am trying to have a service pass, from a parent component, an object to a child component via a . I used the docs to guide me…
Rex
  • 376
  • 2
  • 11
3
votes
4 answers

Convert a Promise to Observable

trying to convert swal's first promise function to observable and trying to use the cancel action. Can someone help me with the syntax pls. swal({ title: 'Are you sure?', text: "You won't be able to revert this!", type: 'warning', …
Anand Rockzz
  • 6,072
  • 5
  • 64
  • 71
3
votes
1 answer

Why isn't there a endWith operator in Rx?

Having such a convenient method like .startWith it would make sense to have his oposite, .endWith, which makes the observable yield a value whenever it gets completed. I have come up with this solution, but is there anything better? This thing gets…
olivarra1
  • 3,269
  • 3
  • 23
  • 34
3
votes
1 answer

How to recover from errors in rxjs?

I'm trying to understand how to consume observable sequences and how to recover from errors. My example is a bit contrived but my real implementation is a bit too complex to show here. Anyway, I have someObservable that emits values when the user…
Joel
  • 8,502
  • 11
  • 66
  • 115
3
votes
3 answers

RxJava zip operation on a varying length of Retrofit Observable array

I have a varying length of Observable array. I would like to zip the requests (i.e. make a bunch of API requests and wait until all of them finish), but I cannot figure out how to implement the zip function. Observable.zip(observables, new…
chubao
  • 5,871
  • 6
  • 39
  • 64
3
votes
3 answers

Clear an Rx.Observable bufferCount with an event driven Timeout?

I'm using rxjs 5.0: How can I set a timeout, on this buffer. So that it will clear the bufferCount (11) when no keyup events happen for 5 seconds? var keys = Rx.Observable.fromEvent(document, 'keyup'); var buffered =…
Armeen Moon
  • 18,061
  • 35
  • 120
  • 233
3
votes
1 answer

Call or cancel timer event angular 2

I basically have a class that should subscribe to commModel.sessionState$ and if isValid is true it should cancel the timer and recreate it again. The problem is that when the timer fires I get this error: TypeError: Cannot read property…
user3719857
  • 1,083
  • 4
  • 16
  • 45
3
votes
1 answer

RXJava 2 /RxAndroid 2 vs Observable vs Listener to Observe from different classes

since i would like to start my new app with a clean base im looking for a good way sharing Informations around different classes. For an example i would like to subscribe to an interface which may be used/shared by different classes. Example for…
Emanuel
  • 8,027
  • 2
  • 37
  • 56
3
votes
1 answer

How to "replay" the last emitted item to each subscriber?

In RxJS I want to give every new subscriber the last item that was emitted. But how do I do that in an Observable chain? this.http.get().map().replaySubject().refCount()
Arlen Beiler
  • 15,336
  • 34
  • 92
  • 135
3
votes
1 answer

I want to use rxjs subject to detect the value change in multiple components. But it only shows change in the component which changes it

I'm using different module so it can be used in lazy loaded modules. here is my service file. import {NgModule, Injectable } from '@angular/core' import {Subject} from 'rxjs/Subject'; @Injectable() export class ChangeEventService { …
YASH DAVE
  • 1,066
  • 12
  • 25
3
votes
1 answer

Error in test when mocking service with Observable (Angular 2)

I have a component that uses a service that returns an Observable. Instead of wiring up this service in my Jasmine test, I've chosen to spy on a mock. Here is the NumProbesService [numprobes.service.ts] that uses Http to get a JSON response from…
Melvin
  • 149
  • 2
  • 11
3
votes
2 answers

How to properly query a Firebase list in AngularFire2?

I'm developing an Angular2 application with Firebase as a backend. On a subpage I want to display some tasks for a given week which is specified by a route parameter. I'm using a BehaviorSubject as a parameter to the AngularFire2 query the following…