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

Angular2 Calling exposed method from outside app and loses change binding

I have a public method that I exposed to window. This method talks to a Component and modifies a variable I am watching in my template. But when I change the value, the *ngIf() does not get triggered. app.component constructor(private _public:…
Rob
  • 11,185
  • 10
  • 36
  • 54
3
votes
2 answers

Angular 2 RxJS Observable Skipping Subscribe on First Call

I'm using a shared service to communicate between a number of components which reside within a modal window, and I'm attempting to get a value which is set within the modal in the component within which it resides. However, when I subscribe to the…
Deej
  • 137
  • 2
  • 9
3
votes
1 answer

Angular 2: Uncaught error when returning Observable

I have the following piece of code: import { Injectable } from '@angular/core'; import { Router, CanActivate } from '@angular/router'; import { Angular2TokenService } from 'angular2-token'; import { Observable } from 'rxjs/Observable'; import…
Jason Swett
  • 43,526
  • 67
  • 220
  • 351
3
votes
2 answers

A better way to pass data from one observable to another

I've created two functions for testing Observables that each return an Observable: foo() { return new Observable(observer => { let i = 0; setInterval( () => { if(i === 10) { observer.complete(); } else { …
Katana24
  • 8,706
  • 19
  • 76
  • 118
3
votes
1 answer

Avoid nested observables

I need to fill in three controls with hierarchic structure: companies, branches, employees. Out of user service I get currently logged in user, then via user's domain name I receive his full data as Employee, then per employee's branchId I obtain…
avj
  • 1,626
  • 1
  • 19
  • 23
3
votes
1 answer

Angular 2 Async Custom Validation with Web API call

I am trying to create a async custom validator to check if a username already exist in a signup form. I have created a service class which calls the Web API (as below) to check the unique user name. I also created a async custom validator which…
Alan B
  • 2,219
  • 4
  • 32
  • 62
3
votes
2 answers

Rx-Java: Creating a configurable Observable

I'm new to RxJava, and I am wondering how I can create a configurable Observable? Let's imagine I could write a DB-to-DB transfer like this: srcDb.getObservable(Bean.class) .sql(selectSql) .params(selectParams) .subscribe( …
3
votes
0 answers

Is it safe to clear observers from the Subject object in rxjs in this scenario?

This seems to work and I am curious to know if this is safe. Take the following scenario... In a shared service class I have: this.subject = new Rx.Subject(); Lets say this observable has multiple subscribers. The subject looks like so…
mrcolombo
  • 587
  • 4
  • 19
3
votes
1 answer

How do I know a FirebaseObjectObservable is empty?

So I have code below get the FirebaseObjectObservable. But the path is dynamic as it might not even there yet. So if the path is not there, I want to create that path. But if it is there, I want to update / patch the data. this.userLocationDetail…
Hugh Hou
  • 2,344
  • 5
  • 31
  • 55
3
votes
1 answer

RxJs Combine Observables

I'm trying to solve problem when i have two Observables which I want to combine into single value in Angular2 and Angularfire2 lets imagine I have bank account and transactions of two types, outgoing and incoming (its just use case i created for…
3
votes
1 answer

Can volatile keyword be used for building thread safe auto clear cache?

I want to code an auto clear cache which in real scenario clears all items in cache once in many hours but has constant read hits. Since clearing and reading are from different threads this data structure needs to be thread safe. Want to avoid locks…
Ira
  • 734
  • 10
  • 7
3
votes
1 answer

angular 2 - routing guard returning observable, understanding

I guess this might more of a rxjs understanding topic but the context illustrates my want of it the best :) So below it the working code inside my PageGuard class, which prevents routing to pages unless a valid jwt exists in localStorage.…
Han Che
  • 8,239
  • 19
  • 70
  • 116
3
votes
1 answer

Observables return type

I'm sending my request to the API and parsing it with the map function: //part of service post(url: string, params): Observable { let requestUrl: string = this.apiUrl + url; return this.http.post(requestUrl, params) …
piernik
  • 3,507
  • 3
  • 42
  • 84
3
votes
1 answer

Angular2 - *ngIf and async observables

I have problem with using *ngIf with observable variables. The thing is that when I hide element with *ngIf, and show it again, values won't load so:
{{ someObservable$ | async }}
Basically…
crotoan
  • 173
  • 1
  • 13
3
votes
2 answers

how do I use `Observable.bindCallback()` with typescript

I've got a google maps direction service I'm trying to convert to an Observable pattern. Here is the example from https://developers.google.com/maps/documentation/javascript/examples/directions-simple: function…
michael
  • 4,377
  • 8
  • 47
  • 73
1 2 3
99
100