Questions tagged [observable]

1

votes
1

answer
1.3k

Views

Angular-Redux Epics

Getting the following error message in console when using the angular-redux library. Also, Redux won't catch or listen for actions after the error occurs. I've searched, including the documentation but nothing points out to fix the error. Am I missing something? Error core.js:1427 ERROR Error: Actio...
Ben Isaac
1

votes
2

answer
710

Views

Angular | Creating an Observable Not Working

In Angular6, I'm creating an Injectable service. I'm trying to initialize an Observable in the constructor, see simplified code below. Problem: The callback function of Observable.create is never executed, and there is no errors. Why is console.log('authObserver created!') never called? import { O...
Vingtoft
1

votes
2

answer
199

Views

Values not loading during initial loading of the observable values

In an Angular application I want to load the menus dynamically from the database(.NEt Core project). For this I created an API service to get the data in json-format. To request this json format from the frontend, I'm using a service in the workout.service.ts-file (I tried it with and without an obs...
Sarath Mohandas
1

votes
2

answer
45

Views

Angular: Still not getting the value after subscribe

In my ts file I have this function: searchForUser() { this.userService.getUserByLastName(this.searchString) .subscribe( (data: User) => this.searchedUser = data ); console.log('Firstname: ' + this.searchedUser.firstName); this.dataService.changeUser(this.searchedUser); } In my html file I get the co...
lisa
1

votes
1

answer
43

Views

RX: How to bind an IObservable<object> to a property (ReactiveUI)

I have class MyClient with an IObservable (Client.StatusStream()). Now I would like to combine ReactiveX and ReactiveUI. But the documentation is not providing any example how to use them together. I have tried some extension methods so far (f.e. .ToProperty), but they are not working. public partia...
Dominic Jonas
1

votes
2

answer
22

Views

Cancel a delay if same observable emits

const observable = new rxjs.BehaviorSubject(0); observable.subscribe(v => console.log(v)); rxjs .of(1) .pipe(rxjs.operators.delay(500)) .subscribe(v => observable.next(v)); observable.next(2); As you can see, the observable above emits 3 values in order : 0, 2, 1. Would it be possible to canc...
trichetriche
0

votes
1

answer
50

Views

Two different observable on same Firestore collection causing memory leaks and showing duplicate results

I'm using @angular/fire to fetch data from firestore. I have two components. one is parent and the other is child. Both of these components are subscribing to observable using async pipes. These are two different observables (but on the same collection). When i arrive on the child route i can see th...
Saad Ashfaq
1

votes
2

answer
5.9k

Views

How to Pause Observable in Angular 2

I am working on my first Angular 2 product. I created this Observable.timer and then subscribed to it. It polls the server for data. My Questions How do I pause and unpause this? ngOnInit(): void { this.poll = Observable.timer(500,500).subscribe((t: any) => { this.request.getRackList(+this.global.zo...
Jerry Huckins
1

votes
3

answer
1k

Views

Rxswift change value of observed object

I am fairly new to Rx and to Reactive Programming in general. I am simply trying to make things work. I'm trying to populate an object after a request to an API (Github's API for the matter): The object to populate : class GithubUser { var login: String? var joinDate: Date? var email: String? } The...
Thiryn
1

votes
2

answer
81

Views

Angular6: why doesn't this work? <div *ngIf=“message$ | async”>{{message$ | async}}</div>

Could anyone help me with the issue. In a element, I want to display the element when an Observable is evaluated available, and also display the content of the Observable value. Please see the code below: html {{message$ | async}} button ts message$ = new Subject(); ngOnInit() { this.message$.next(...
lijiejacklee
1

votes
3

answer
89

Views

How to return value as an observable in angular 6

I want to return value (any data) from service to component as an observable. After a couple of digging into observables found following solution: class AppService { getData(value) { // do we have any other best way to return value as an observable return Observer.create((observer) => { observer.nex...
upgoingstar
1

votes
2

answer
44

Views

canActivate returns unwanted value

I have a canActivate method that I would like to implement, but for some reason(which I'm probably not aware of since I'm a newbie) the return value is happening before the subsribe completes. canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): boolean { debugger; this.ms_zehu...
Yaniv Eliav
1

votes
0

answer
23

Views

Bind data from API to Dropdown in Angular 7

I'm trying to populate a dropdown from a get API. I've created a service and using the observables returning the data to the component, which then subscribes to the service. I'm able to console.log the whole data (which is in a JSON array) but I'm not able to see any data in the dropdown. I guess th...
Sunil Ojha
1

votes
0

answer
39

Views

How to disable re-sending request after it was canceled in Angular 2

I have a http request like this. let request:Observable = this.http.post( someUrl, someData) Now I want to cancel this request after sending.When I call request.subscribe().unsubscribe() it cancels the request and re-sending it again. I want to prevent re-sending it after cancel.
AngularDev
1

votes
1

answer
59

Views

Observable not repeating

I'm trying to repeat() an action in an observable but it is not performing it more than once. Observable.create(new ObservableOnSubscribe() { @Override public void subscribe(ObservableEmitter e) throws Exception { // **** Code Here is not repeating **** e.onNext(pullMessagesFromServer()); } }) .repe...
Airagale
1

votes
0

answer
43

Views

View not updated if service.variable got changed

I am learning Angular2 after I learned AngularJS. Actually I got a problem to solve View updates. Think this could get done with Oberving, but any try to implement an observable variable failed. My Problem: My Training APP got three rows (header, extension, status), each row got a component. In...
n00n
1

votes
0

answer
220

Views

Angular 2 call Observable on component Initialize

I want to call observable on component load. In Below function. I have monthly() in service in which i am sending data using subject next(). I want to send data from load component to receive component. current when i hit toggle-button using (change) event data is sen correctly to receive function b...
Jay
1

votes
1

answer
544

Views

How I can call Observable.complete callback function? It doesn't work

In ionic 2, (and [email protected], [email protected]) I tried this code, but complete function doesn't work! constructor(public af: AngularFireDatabase, ...) { this.temp = af.list('/myTest').subscribe(data => { ... // my tastks }, error => { console.log(error); }, () => { console.log('done!');...
Harine
1

votes
1

answer
267

Views

RxJs and redux-observable. Append value when ajax succeed or failed

I have the following epic: export const changeTeamSubscriptionPlan = (braintreePlanId: string) => ({ type: CHANGE_TEAM_SUBSCRIPTION_PLAN, braintreePlanId, }); export const changeTeamSubscriptionPlanEpic = (action$: any, store: Store) => action$.ofType(CHANGE_TEAM_SUBSCRIPTION_PLAN) .mergeMap(({ brai...
Tomasz Mularczyk
1

votes
1

answer
276

Views

How to easily test redux-observable epic that emits an action after 5 minutes?

I have an epic that emits SOME_OTHER_ACTION when 5 minutes have passed after SOME_ACTION (using delay operator). I want to use jest or sinon useFakeTimers method to be able to do the following: dispatch an action, wait 5 minutes and test if another action was dispatched. I really don't want to use m...
Sasha Tobin
1

votes
1

answer
88

Views

Subscribing sequentially to a variable number of Observables in Angular 2+

Sorry if this was answered elsewhere, I tried to search but I'm not even sure what I'm looking for. Let say I have this object to work with: userRequest: { id: number, subject: string, ... orderIds: number[] ... } order: { id: number, ... clientId: number, productIds: number[] } client: { id: number...
Chris Lemire
1

votes
1

answer
226

Views

R Shiny selectize observeEvent on all choices made

I have the following Shiny app and I would like for the observeEvent to only trigger when all choices are made from the selectizeInput UI. The reason for this is that I have a dynamic number of maxItems (which i set arbitrarily to 2 for this example) so I cannot just base the observeEvent off the le...
J. Doe.
1

votes
0

answer
238

Views

How to test the output of an NgForm function in angular

I want to test the result from submitting my form in angular but I am not sure what to expect. I have created my mock data and created a spy with with jasmine but I write the expect. I know it returns an Observable but how do I test that? My template const testForm = { value: { address: { billing_ad...
Arthur Decker
1

votes
1

answer
126

Views

How do I update data from Observable without having to re-subscribe/add disposable where I can delay the rendering of layout.xml until data is loaded?

My ViewModel is returning nullfields for current User how to fix? Say I had the following Disposable. getUserProfile calls a Retrofit 2 API that returns Observable
bycfly
1

votes
0

answer
324

Views

Observable timer to using setInterval

Apparently I am experiencing some odd behaviour when I use Observable.timer in Chrome. I am using a countdown component which counts down from a specific time till 0. When I executed the countdown in one tab, changed with another tab and come back to the original tab later, countdown seemed to be ex...
bbusdriver
1

votes
1

answer
53

Views

how to extract data from an object that came from http.get response

I have an API that responds with the following object of type json : { 'triggerCount': { 'ignition_state_off': 16, 'ignition_state_on': 14, 'exit_an_area': 12, 'enter_an_area': 19, 'door_unlocked': 1, 'door_locked': 1, 'fuel_level_below': 12 } } I get the response through this injected service : in...
ibrahim.bond
1

votes
1

answer
309

Views

JavaFX ObservableList with extractor update event not firing when it should

A little background: Before I had a problem where I had ObservableList with extractor, but the properties that extractor was listening to were updated from NOT JavaFX thread. The solution I came up with was to create 'UI equivalent' classes that would copy values of original class, just update thei...
ESipalis
1

votes
1

answer
137

Views

Use RxJs to create HttpRequest queue in Angular2+ interceptors

I am using interceptors in Angular5 to add an Authorization header to each request. The tokens coming from the backend can expire though, in which case a token refresh must occur. If multiple HttpRequest come in at the same time, I have no way of making them queue up, so multiple unauthorized reques...
resu
1

votes
0

answer
26

Views

Is an observable just a partially applied function?

For clarity, this question applies to the observable pattern implemented in javascript (the code I'll write here is all ES6). Recently I've been trying to figure out how observables actually work. I found a couple articles/posts that describe them within the context of creating a class that takes a...
MFave
1

votes
0

answer
109

Views

Angular filter observables with criteria

in an angular 5 project, I want to filter observables with a criteria. The criteria should tell the filter in which column he must filter. The param data contains the term and the criteria from the search formular. I don't know where to add the criteria param. My actual code: public search(data: any...
A. Mehlen
1

votes
1

answer
118

Views

Convert a Variable into Observable Stream

I have a use case where the width of a particular div changes w.r.t dom and i am using view child to tap on to the width . I want to only use the latest width value where as Angular gives intermediate Results too . How can i convert a variable into a Observable Stream . I tried using Observable.of b...
INFOSYS
1

votes
1

answer
419

Views

redux-observable How to dispatch multiple actions with pipe?

I realized that const pingEpic = action$ => action$.ofType('PING') .delay(1000) // Asynchronously wait 1000ms then continue .mapTo({ type: 'PONG' }); mean dispatch({ type: 'PING' }); dispatch({ type: 'PONG' }); Howeber, I don't realize how to dispatch two actions with pipe. my code is below const s...
sonicmario
1

votes
0

answer
144

Views

JavaFx: ObservableHashSet

I was wondering in FxCollections there are many methods for creating the observable variant of a 'simple' Collection like ArrayList or of a HashMap, but I don't find an .observableHashSet for example. I know I can create by using FxCollections.observableSet(new HashSet()) but there are also methods...
Sunflame
1

votes
1

answer
127

Views

Observable is not saving the data when refreshing the page manually

I have this code in my service constructor: this.getUser().subscribe( data => this.user = data.text(), error => console.log(error) ); When navigating in my app with router links (from menu) this code works, but when refreshing the page manually... data.text() includes the logged-in user (I can see i...
zbeedatm
1

votes
0

answer
127

Views

Redux middleware, Uncaught TypeError: Cannot read property 'type' of undefined

Hi i have a problem with fetching data by middleware in redux. this is my MW: export const tokenMiddleware = store => next => action => { switch (action.type) { case 'NEAR_YOU.FETCH': const { getState, dispatch } = store; console.log('NEAR_YOU.FETCH', action); dispatch({ type: 'RESET_TOKEN', method...
Lukáš Šálek
1

votes
0

answer
255

Views

Rxjs Scan method copies content of array property of Observable when new items added

In an Angular component I have a property of type BehaviourSubject: controllerData$ = new BehaviourSubject(null); IController { users: IUser[]; showDetails: boolean; } I need to iterate over the users array of type IUser and execute an intermediate transformation over the property data before return...
Francesco
0

votes
0

answer
6

Views

Getting value from observable from parent widget to child

I have a some ParentWidget which is called using showModalBottomSheet. It is also wrapped by successor of InheritedWidget (BlocProvider) to allow children of ParentWidget to have access to Bloc. The date displayed on ChildWidget1 can be modified somehow (see InkWell widget). Then I switch to ChildWi...
Aleksei Timkov
1

votes
1

answer
273

Views

How to make multiple ajax call concurrently in redux-observable?

I have an array of string schemaNames = [schemaName1, schemaName2 ...], for each element in the schemaNames, I want to make a restful call, to get the schema, and I want to get the result as an object. I come up a way like this export const fetchSchemasEpic = action$ => action$.ofType(FETCH_SCHEMAS....
leuction
1

votes
2

answer
357

Views

RxJava - Observable which emits items which are new or changed

I am a newbie in reactive world and trying to implement the following scenario with rxjava/rxandroid 2.x. I have a local data set as ArrayList mItems in Application class. The same data set is synchronized with server and updated every time user opens the app. However before server returns the respo...
Pawan
1

votes
0

answer
474

Views

fromPromise cause “pipe is not a function” Redux-observable

I'm new to rxjs and redux observable. fromPromise cause the error. FCM.getFCMToken() is API like fetch. It returns a string. My code is below. import { fromPromise } from 'rxjs/observable/fromPromise'; const successLoginWithSessionTokenEpic = (action$: Observable, store: any) => action$.pipe( ofType...
sonicmario

View additional questions