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
57
votes
6 answers

RxJs get value from observable

In component : singleEvent$: Observable; On init, I get observable this.singleEvent$ = this._eventService.events$ .map(function (events) { let eventObject = events.find(item => item.id === eventid); let eventClass: Event = new…
SuperOrange
  • 673
  • 1
  • 5
  • 5
56
votes
2 answers

RxJava Fetching Observables In Parallel

I need some help in implementing parallel asynchronous calls in RxJava. I have picked up a simple use case wherein the FIRST call fetches (rather searches) a list of products (Tile) to be displayed. The subsequent calls go out and fetch (A) REVIEWS…
diduknow
  • 1,624
  • 2
  • 13
  • 10
55
votes
4 answers

How to return value inside subscribe Angular 4

I'm new to observables in angular. I have a problem where I want to return a value inside a subscribe method. I have the following method (getFirebaseData(idForm:string):observable ): getTotalQuestions(idForm:string){ let…
AlejoDev
  • 4,345
  • 9
  • 36
  • 67
55
votes
7 answers

Which browsers support Object.observe?

Which browsers, if any, support Object.observe? I'm surprised I'm unable to find any info on this. (And are you aware about any estimated times of arrival for this feature?) About Object.observe: "Object.observe allows for the direct observation of…
KajMagnus
  • 11,308
  • 15
  • 79
  • 127
54
votes
4 answers

Typescript Angular - Observable: how to change its value?

Maybe I'm missing something. I can't find a simple tutorial for Observable and its syntax. I'm working with Angular, I need to call a function (defined in a component) from a service. I read this solution. But I can't figure out how to change the…
Johannes
  • 675
  • 1
  • 7
  • 12
54
votes
2 answers

What are use cases for mergeMap operator?

I don't understand the purpose of mergeMap at all. I have heard are two explanations: It's like SelectAll() in .NET LINQ - nope. It's a combination of RxJS merge and map - nope (or I can't replicate this). Consider the following code: var obs1…
VSO
  • 11,546
  • 25
  • 99
  • 187
53
votes
7 answers

Android data binding : view does not update when property is changed

let me first start with showing the code: build.gradle (module): android { compileSdkVersion 24 buildToolsVersion "24.0.2" dataBinding { enabled = true } defaultConfig { applicationId "com.example.oryaa.basecalculator" minSdkVersion 15 …
user5190190
52
votes
2 answers

Why is java.util.Observable not an abstract class?

I just noticed that java.util.Observable is a concrete class. Since the purpose of Observable is to be extended, this seems rather odd to me. Is there a reason why it was implemented this way? I found this article which says that The observable is…
50
votes
3 answers

Observable type error: cannot read property of undefined

In my Angular 2 application, I get an error: Cannot read property 'title' of undefined. This is a very simple component, just trying to get a bare minimum to work here. It hits my API controller (curiously multiple times), and it appears to hit…
Ryan Langton
  • 6,294
  • 15
  • 53
  • 103
48
votes
4 answers

RxJS observable which emits both previous and current value starting from first emission

I have a BehaviorSubject which emits JavaScript objects periodically. I want to construct another observable which will emit both previous and current values of the underlying observable in order to compare two objects and determine the delta. The…
Slava Fomin II
  • 26,865
  • 29
  • 124
  • 202
48
votes
1 answer

Does Subject.complete() unsubscribe all listeners?

I build a simple confirmation dialog service (Angular 2) with this method: confirm(body?: string, title?: string): Subject { this.confirmation = new Subject(); // ... show dialog here... "are you sure?" return…
Wolfgang
  • 2,188
  • 1
  • 25
  • 24
48
votes
2 answers

Observable.forkJoin and array argument

In the Observables forkJoin documentation, it says that args can be an array but it doesn't list an example doing so: https://github.com/Reactive-Extensions/RxJS/blob/master/doc/api/core/operators/forkjoin.md I have tried a function similar to what…
Benjamin McFerren
  • 822
  • 5
  • 21
  • 36
48
votes
2 answers

rxjava merge observables of different type

I'm new to rxjava. I need to combine two observables that emit objects of different type. Something like Observable and Observable and get a Observable. I couldn't find any operator for something like this. What would…
Jelly
  • 4,522
  • 6
  • 26
  • 42
47
votes
3 answers

Angular 6 / Rxjs - how to basics: observables success, error, finally

I'm building an architecture on latest Angular 6 and coming from AngularJS there's something I can't make peace about: the basic processing of an HTTP request. So, for the sake of the question, let's say I…
Simon Peyou
  • 693
  • 1
  • 6
  • 13
47
votes
3 answers

Knockout Filtering on Observable Array

I've started learning Knockout and I'm having some trouble filtering an observable array on a button click and displaying the results. This is my model: function Product(data) { this.id = data.id; this.name = data.name; this.price =…
SkelDave
  • 1,176
  • 2
  • 9
  • 23