observable Questions

3

Solved

I have the following block of code for my nested observable and am trying to get observable<user[]> which this code is not doing: return this.findUser(term).map( users => { return users.m...
Drayman asked 6/11, 2016 at 2:27

3

In angular, we use HttpClient to make HTTP calls which return an observable, if we wanna use promises we can use lastValueFrom/firstValueFrom. Let's say we have: async getLast() { const get$ = thi...
Apposite asked 19/10, 2021 at 11:6

2

Solved

imagine situation when you have some Observable that contains data that changes in real time, example below... interface User { name: string; projectId: string; dataThatChangesALotInRealTime: O...
Edina asked 9/12, 2018 at 12:56

5

Solved

I have exact same requirement as mentioned in Add queueing to angulars $http service but need implementation in Angular 4.3 or 5 using the HttpInterceptor from @angular/common/http. I have a very ...
Parsee asked 29/12, 2017 at 11:14

3

Solved

I think I must be misunderstanding something fundamental, because in my mind this should be the most basic case for an observable, but for the life of my I can't figure out how to do it from the do...
Drone asked 24/10, 2015 at 22:57

8

Solved

Someone, please explain the difference between SwitchMap and FlatMap in terms of Javascript ( in angular perspective, rxjs 5) In my understanding. SwitchMap only emits the latest observable value a...

6

Solved

How can I get the current value from an Observable without subscribing to it? I just want the current value one time and not new values as they are coming in.
Earthaearthborn asked 20/5, 2016 at 6:1

2

Is there a way to make pandas Dataframes observable? Lets say I have some Dataframes A, B, C that have the same index and C is calculated by C = A + B If I change a cell value in A (e.g. 2 => 4...

4

I've been building a SPA with Angular 4 on the front end and ASP.NET Core 2 on the Backend. Basically, I'm trying to automatically renew an user login, given a valid token. When I reload a page, fo...
Capitalist asked 8/2, 2018 at 23:30

4

Solved

I have the following code: public obs$: Observable<boolean> <div *ngIf="(obs$ | async) === true || (obs$ | async) === false"> {{ (obs$ | async) ? 'yes' : 'no' }} </div> It w...
Eclectic asked 22/3, 2019 at 9:46

4

Solved

I am trying to migrate from rc1 to rc4 and i have trouble getting query string parameters. ActivatedRoute object always empty. hero.component.ts import {Component, OnInit} from "@angular/core"; i...
Australoid asked 20/7, 2016 at 18:50

3

Solved

I am trying to mock the PUT call of HttpClient of Angular to throw error. I am using throwError for it. It isn't working. What should I change to make it throw the error and call the handleError me...
Enedina asked 8/6, 2020 at 20:20

6

Solved

I have a few observables. And I need to know which one triggered the subscribe. Observable.combineLatest( this.tournamentsService.getUpcoming(), this.favoriteService.getFavoriteTournaments(), t...
Grudge asked 25/11, 2016 at 12:4

3

Solved

I have a simple setup to show a loading spinner when the async pipe is null: <div *ngIf="(searchResults$ | async) as searchResults; else loading"> </div> <ng-template #loading> ...
Drinking asked 17/2, 2019 at 21:46

15

Solved

The function more() is supposed to return an Observable from a get request export class Collection { public more = (): Observable<Response> => { if (this.hasMore()) { return this.fetch(...
Vancevancleave asked 24/7, 2016 at 3:17

6

Solved

I have a service with a subject: @Injectable() export class UserService() { private currentUserSubject = new BehaviorSubject<User>(null); public currentUser = this.currentUserSubject.asObs...
Jahdiel asked 27/3, 2017 at 10:6

1

Solved

I have a more complex object that I want to be observable for Jetpack Compose. However I can't use // in my view model var observableProperty by mutableStateOf(myObject) because I need myObject to...
Stannary asked 22/8, 2022 at 19:38

3

Solved

Can an async generator be somehow broadcast or multicast, so that all its iterators ("consumers"? subscribers?) receive all values? Consider this example: const fetchMock = () => "...
Cousin asked 23/8, 2020 at 4:40

3

I want to add a resize observer to a div element in my dom to give me a callback when it resizes. I know it can be done using the ResizeObserver, but as its not supported in all browsers, i would ...
Parson asked 10/3, 2019 at 19:29

4

The documentation for RxJS defines AsyncSubject as follows: The AsyncSubject is a variant where only the last value of the Observable execution is sent to its observers, and only when the execut...
Rodie asked 17/1, 2018 at 17:34

6

Solved

How can I test Observables with Jest? I have an Observable that fires ~every second, and I want to test that the 1st event is correctly fired, before jest times out. const myObservable = timer(0,...
Hustings asked 5/6, 2018 at 10:58

4

Solved

Angular 2 ngModel directive works with variables and functions like <input [ngModel]="myVar" (ngModelChange)="myFunc($event)" /> Instead of variables and functions, I wou...
Ashes asked 9/8, 2016 at 7:41

6

Solved

Question For testing purposes, I'm creating Observable objects that replace the observable that would be returned by an actual http call with Http. My observable is created with the following cod...
Alarm asked 23/2, 2017 at 11:5

6

There are many ways to handle multiple subscriptions efficiently in a component, I have 2 ways here and wanted to know which is more efficient and why?? Method 1: Using Array Step 1: creating Array...

3

Solved

I'm attempting to write a custom delegate which would clean up the syntax for databinding in a Kotlin class. It would eliminate the need to define a custom getter and setter for every property I mi...
Saguaro asked 4/9, 2017 at 2:31

© 2022 - 2024 — McMap. All rights reserved.