Questions tagged [observable]

1

votes
2

answer
115

Views

RxJS iif arguments are called when shouldn't

I want to conditionally dispatch some actions using iif utility from RxJS. The problem is that second argument to iif is called even if test function returns false. This throws an error and app crashes immediately. I am new to to the power of RxJS so i probably don't know something. And i am using...
E1-XP
0

votes
1

answer
25

Views

How can I measure the duration between 2 actions using redux-observable epic?

I'm trying to measure the duration of 2 actions using redux-observable epic. There is an answer related but it doesn't really help in my situation. In redux-observable, how can I measure the epics duration time when running complete? testeeEpic = action$ => action$.ofType('TEST_START', 'TEST_EMD')...
Lin Shen
1

votes
1

answer
32

Views

Rxswift validate inputs before sending api request

I have a login screen, I was showing previously error input above textfield and disable button by combining email/password Bool Observable, however now the design is changed and I want to check if email/password are not empty before sending the request or show alert dialog My issue is with how to v...
George2456
1

votes
1

answer
22

Views

RxJS missing values when using combineAll with 2 observables

I'm trying to generate overs for a cricket match simulation with values as follows: Overs -> 0 - 19 (total 20 overs) Balls -> 1 - 6 (total 120, each over has 6 balls) Hence the sequence that has to be generated would be something like 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 1.1, 1.2, 1.3, ....., 19.4, 19.5, 1...
Ishan Khare
1

votes
2

answer
30

Views

RXJS - Multiple observable calls on array of properties

I'm kind off new to rxjs, and I've a fairly simple case that I can't work out in angular. I've a http call to retrieve a group, this group contains a list of 'buddy ids', a list of 'genre ids' and a 'region id'. To get the buddy objects trough the 'buddy ids', I have to make a call to an API trough...
TanguyB
0

votes
1

answer
14

Views

I keep Getting this Error Observable<{}> not assignable to Observable<Product> Angular 7

I am using Visual studio IDE for MAC, I can build the Angular 7 application but cannot run the app in browser. I am getting the error in the second method.Observable not assignable to Observable import { Injectable } from '@angular/core'; import { Product } from '../interfaces/product'; import { Htt...
delta demon
1

votes
0

answer
14

Views

Angular 6: how to get http at an interval

I can't seem to get this solution to work for my code. This is my original code that works without interval. But unfortunately, it makes too many requests. import { HttpClient, HttpHeaders } from '@angular/common/http'; import { Observable } from 'rxjs/Observable'; constructor(private http: HttpCl...
vt2424253
0

votes
0

answer
7

Views

Redux Dev Tools doesn't show state change, action.payload is { }

I am trying to figure out why Redux-Devtools does not show state change because it shows that action={ type: 'GET_LOCATION_SUCCESS', payload: {} }, while debugger and console.log() shows that action.payload is n. I am using redux-observable rxjs typesafe-actions This is my action creator: import { c...
luksari
0

votes
0

answer
8

Views

Filter an array of nested object - Observable

I have an observable of an array which contains objects of an object. (as shown in the image). I have an observable which receives these values from a get request and then I have another observable for storing filtered values. I have a searchText variable binded to an input and I am calling a functi...
kinny94
0

votes
2

answer
19

Views

Return Observable within Async Function

I'm having trouble with the data I get from the server. I need to check if a username is available and then execute an http.get which is no problem, thing is I need to return the content of the http.get as an observable to create an object later. registerUser(user: RegisterComponent): Observable { l...
Antonio Gonzalez
1

votes
2

answer
250

Views

How to access outer element inside Repeater?

Javascript var pageData = new Observable({ appointmentsList: appointmentsList, user_role: '' }); exports.onLoaded = function (args) { page = args.object; page.bindingContext = pageData; pageData.set('user_role', appSettings.getString('role')); XML In above snippet that problem is i am not able to ac...
Hardik Vaghani
1

votes
1

answer
471

Views

Angular “scheduler.schedule is not a function” using observable

I'm having an issue with an observable : In a service I have a function (in edit.component): public patchOne(entity: Tier): Observable { const userData: any = this.httpService.getDataFromLocalStorage(AuthService.LOCAL_STORAGE_USER_TAG); return this.httpService.patch(`/someurl/${entity.uid}`, { par...
An-droid
1

votes
1

answer
1.2k

Views

RxJS: takeUntil with multiple actions and different filters?

I have an Observable that I want to continue executing until: 1) the uploadActions.MARK_UPLOAD_AS_COMPLETE action is called with a certain payload OR 2) the uploadActions.UPLOAD_FAILURE action is called with any payload This is as far as I could get (and doesn't work): return Observable.interval(500...
Edmund
1

votes
1

answer
136

Views

Subscribe to existing observable unless it's completed

I've had the need for such a construct several times already, and I don't quite know how to approach it. My problem is: when A happens, I want to create a complex observable (made by combining few operators). It will asynchronously complete some action, publish the result and complete. Meanwhile I w...
wasyl
1

votes
1

answer
486

Views

Iterating through http response Angular2

So I'm very new to Angular2, and trying to iterate through http response I'm kindda stuck. With the following code : ngOnInit() { this._meetService.getAuth( 'meets/'+ this.meetId + '/participants').subscribe( meet => { this.participants = meet.participants; this.organizators = meet.organizators; con...
theFreedomBanana
1

votes
1

answer
707

Views

Example of using a service singleton as data source in Angular 2

I need a good example of using a service singleton as data source for my Angular 2 application. Scenario is as following: I have an application that is loading prices of some items from the local database (in my case MongoDB). A few of the components need to use a service which will be the univer...
Miloš Stanić
1

votes
1

answer
260

Views

JavaFX ListView duplicate removal error

link to imgur @FXML ListView queueList; ObservableList SongQueueObservableList; queueList.setCellFactory(new Callback() { @Override public ListCell call(ListView myObjectListView) { ListCell cell = new ListCell(){ @Override protected void updateItem(QueueSong myObject, boolean b) { super.updateItem(...
user3277087
1

votes
1

answer
306

Views

Sharing an observable/subject in Angular2

EDIT: For what it's worth, I've learned that the SharedService is getting initialized twice. I suspect I'm working with separate instances, which is why the .subscribe() is limited only to the initiator. I don't know how to correct this... I thought everything was a singleton in Angular2? I have...
oooyaya
1

votes
1

answer
153

Views

Angular2 http in bootstrap

How can I tell to angular2 to wait for something in the bootstrap? My component uses a service, which is provided in the bootstrap, but this service uses one HTTP POST and one HTTP GET, to initalize its values, so when my app bootstraps it says cannot read property of undefined.
bucicimaci
1

votes
1

answer
1.1k

Views

Set initial value of computed or supress the first evaluation

[This seems to be impossible. I will answer this question by myself later] This question largely continues my pervious one. I use 'async computed' approach to refresh some parts of my page. Thanks to Michael Best I solved issue with updates of invisible parts of UI. But one annoying thing still here...
shameleo
1

votes
1

answer
965

Views

Finally on rxjs sequence gets executed on first error

I try to execute a finally statement on a Observable - sequence of http-calls. The finally method gets executed on the first error, and not when the complete sequenze is finished. deleteLeistungsTarife( leistungsTarife: Shopeinstellungen.LeistungsTarif[], leistungstarifGeloeschtCallback: (leistungsT...
Weissvonnix
1

votes
1

answer
1.7k

Views

Angular 2 view not updating after I update a record in the database

I have a simple CRUD app using Angular 2. The main page displays a list of cards a user can create, edit, or delete. On the card edit page, when I click submit, it calls this: card-edit.component.ts onSubmit() { this.updateCard(this.card); alert('Card updated!'); this._router.navigate(['/Ca...
Derek
1

votes
2

answer
984

Views

How to chain 2 Observables with Angular2

I trying to do the following without success. I am trying fire an http request/Observable depending on a previous http request result. ngOnInit() { this._lights.LastChannel(this.hostname).subscribe(data => { this.LastChannel = data.Message; this.shields = this.LastChannel / 8; if (this.LastChannel %...
CESCO
1

votes
2

answer
1k

Views

RxJS and typescript : Observable.flatMap do not behave correctly

In typescript, it seems that the RxJS Observable.flatMap is not behaving correctly with Observable created with Observable.fromPromise(promise). I suspect that it does not trigger the change detection. I have these 2 functions (in _httpClient class) : ObservableFromPremise() : Observable{ var promis...
Geoffrey D
1

votes
2

answer
923

Views

Chaining Subjects - RxJS / Angular2

I am very new to observables and I'm trying to get my mind around a good way to chain subjects. Essentially, I'm trying to take an array of observables that will all emit the same type and chain them together so that, when I call next on the first subject, every subsequent subject (assuming no error...
sgcharlie
1

votes
1

answer
372

Views

Angular 2 listen web api changes [closed]

I am creating a todo list with Angular 2 on top of an ASP.Net Core 1.0 Api. How do I allow changes made on one device to push to other devices? A push or post is made on one device, then a get is made, then other 'users' will get the changes without having to manually refresh the page.
Pezetter
1

votes
1

answer
351

Views

ReactiveUI Change observable notifications has strange order

I have an ReactiveObject: public class Example : ReactiveObject { private string _commonProperty; public string CommonProperty { get { return _commonProperty; } set { this.RaiseAndSetIfChanged(ref _commonProperty, value); } } private readonly ObservableAsPropertyHelper _dependent; public string Depe...
Inok
1

votes
1

answer
227

Views

Send data to all subscribers elements with observable - angular2

I want to send data to my all elements called 'modal', but only one of them reciving message. I have a service: @Injectable() export class ModalService { private _isOpen = new Subject(); isOpen$ = this._isOpen.asObservable(); open(id: string) { this._isOpen.next({isOpen: true, id: id}); } close(id:...
Verri
1

votes
2

answer
2k

Views

Execute function after chain of observable subscriptions completes (Angular 2)

I need to execute a function that works on the data resulting from a chain of observable subscriptions but only after it finishes creating my object. Here's my chain: getFilters() { this.filterSvc.getCamps() .subscribe( c => { this.filters = c; for (let camp of this.filters) { this.filterSvc.getBui...
Methodician
1

votes
1

answer
4.3k

Views

Cancel observable after first time - Angular2, TypeScript, rxjs/Observable

I’m doing a check for existing login at start of app which I want only once. How do we cancel that subscription after the first time? I tried take(1) but that doesn't seem to work. this.auth.getUserData().take(1).subscribe(data => { // the take(1) doesn't work console.log('Firebase responded w...
sathishvj
1

votes
1

answer
106

Views

Angular2: AsyncPipe and Observable, can't retrieve property (TypeError: Cannot read property … of null)

I try to retrieve property of object that is returned by Observable However I see some examples in answers at SO, in my app I get error. The same error is reproduced in Plunker: http://plnkr.co/edit/X5xNDOFmCpLOnzv4X0xo?p=preview @Component({ selector: 'my-app', providers: [AppService, HTTP_PROVIDER...
DicBrus
1

votes
2

answer
98

Views

Observable: Return the result of a Promise until unsubscribed

I want to write a function that returns an Observable to subscribe to. The Observable should emit the result of the Promise every three seconds. The following function returns the Promise, but i would like it to return the result of the Promise: public static getWifiInfos(): Observable { return Obse...
JoCa
1

votes
1

answer
648

Views

How to combine two observables in Reactive Extensions in order to paginate results?

I am trying to develop a pagination system in an iOS app using RxSwift. The use case is simple: the user can enter text in a search field and the app performs a request that is paginated. When he changes the value, a new request is performed on the first page (that means the value of the observable...
obo
1

votes
1

answer
319

Views

How to check Kendo Observable has changed

Hi I have a form that contains Certain fields and I have made it as Kendo Observable as follows var TITLE = $('#TITLE').val().trim(); var DESC = $('#DESC').val().trim(); Analysis.Kendo_VM = kendo.observable({ TITLE: TITLE != null ? TITLE : '', DESC: DESC != null ? DESC : '', }); I want to Check if...
SantyEssac
1

votes
3

answer
832

Views

Angular 2 http - combine multiple Observables

I'm totaly new in async Observable world. I hope somebody help me. I have two Observable and I want to combine them. I tried to use: var obs1 = Observable.of(true).delay(1000); var obs2 = Observable.of(false).delay(100); obs1.combineLatest(obs2, (obs1Val, obs2Val) => { //bool result }); and that...
Kuba
1

votes
1

answer
245

Views

custom cordova pushNotification wrapper returning observable

the phonegap-plugin-push for cordova has several functions with the following syntax function name(successCallback(),errorCallback(),options) I want to write a wrapper function and return an Observable but I'm a little stuck on how to create it using typescript for angular2. so name.subscribe((data)...
Han Che
0

votes
1

answer
25

Views

How to create an Observable of type boolean?

I need to create an Observable that emits a booleand and can be changed from a function. I tried showModal$ = new Observable(); But it does't works. What I need is showModal$ to be false by default. And change its value with a function change() { this.showModal$ = !this.showModal$; } I'm using Angu...
akko
1

votes
2

answer
967

Views

How to debounce the observer function in angular 2?

I'm trying to listen to the onScroll event in angular 2 and I've created the following code which works, however every scroll event is calling next and it's hitting browser performance. I was hoping that the observer.next function would be very lightweight and debouncing at the subscriber would be e...
SMC
1

votes
3

answer
977

Views

RxJS Observable fire onCompleted after a number of async actions

I'm trying to create an observable that produces values from a number of asynchronous actions (http requests from a Jenkins server), that will let a subscriber know once all the actions are completed. I feel like I must be misunderstanding something because this fails to do what I expect. 'use stric...
laffoyb
1

votes
1

answer
1.2k

Views

Using RXJS to extract single value from observable with no mutation

I am trying to create a wrapper service for Angular 2's Http Service that saves returned Headers without mutating the returned Observable. Essentially, I want to call any Angular 2 Http method (i.e. http.get()) and then return the Observable but save the Response object contained in the observable....
Pat Murray

View additional questions