Sort nested observable

Issue I have here a JSON file which looks like this: [ { “question”: “What is your age range?”, “options”: [“10-20″,”20-30″,”30-40″,”40-50”] }, { “question”: “How did you find us?”, “options”: [“Friend recommendation”,”Google”,”Other”] }, { “question”: “Are you interested in etcetc?”,

Continue reading

rxjs-marbles testing has no expectations

Issue I use rxjs-marbles for testing observables in my Angular 7 app. But it looks like m.expect is not recognized by jasmine as expectation. I have following test: it(‘should see expectations’, marbles(m => { const source: Observable<Message> = m.hot(‘^a–b–c’); m.expect(source).toBeObservable(‘-a–b–c’);

Continue reading

How to test pending flag in Angular

Issue I have fetchBooks method that retrieve data from backend and then populates books variable. import { Component, OnInit } from "@angular/core"; @Component({ selector: "app-root", templateUrl: "./app.component.html", }) export class AppComponent implements OnInit { isLoading: boolean; books; constructor(private booksService: BooksService)

Continue reading

Angular Dropdown Excel Post

Issue I want to create a selection dropdown that when the user select a value it will send to the backend controller. This is my code so far anyone could help HTML <mat-form-field appearance="fill" class="dropDown1"> <mat-select [(ngModel)]="selectedTemplate"> <mat-option *ngFor="let items

Continue reading

[Object][Object] angular

Issue I’m trying to display the value in my form why i get [Object][Object] in my display i tried the ngModel but i have a validators this is the out TS ngOnInit(): void { this.Form = this.fb.group({ Code: ({value:this.idObj,}, Validators.required),

Continue reading

Rxjs subscribe deprication

Issue After going through a tutorial, I noticed the ‘subscribe’ was being deprecated. I tried following https://rxjs.dev/deprecations/subscribe-arguments and some stackoverflow questions like Typescript Deprecation warning but was not able to update to the new approach. I’ve include the code in

Continue reading

valueChanges event observable not caught in RXJS in angular

Issue In constructor I have: this.step1FormGroup = this.formBuilder.group({ firstLastName: new FormControl(”) }); this.step1FormGroup.get(‘firstLastName’).valueChanges.pipe( map((a) => { console.log(‘oy!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!’); return a; }) ); and in template I have this: <form [formGroup]="step1FormGroup"> <ng-template matStepLabel>Fill out your name</ng-template> <mat-form-field> <input matInput placeholder=’Last name, First

Continue reading

Angular test 'subscribe is not a function'

Issue In my component inside ngOnInit I have a subscribe() inside which I call a component function: ngOnInit(): void { this.navigationService.itemReset$.subscribe(event => this.resetItem(event)); } in the navigationService I have: btnPressed$: Subject<Event> = new Subject(); itemReset$: Observable<Event> = this.btnPressed$.asObservable(); keyDown(event: Event):

Continue reading

RxJS5 TypeScript typings fail

Issue I run tsc on my project, and I get these errors relating to the RxJS5 lib: $ tsc node_modules/rxjs/observable/FromEventObservable.d.ts(11,39): error TS2304: Cannot find name ‘EventTarget’. node_modules/rxjs/observable/FromEventObservable.d.ts(11,103): error TS2304: Cannot find name ‘NodeList’. node_modules/rxjs/observable/FromEventObservable.d.ts(11,114): error TS2304: Cannot find name ‘HTMLCollection’.

Continue reading

How add all arrays to one in rxjs

Issue how i can add all arrays to one in rxjs for this code? someObs$ = this.getSomeData$().pipe( mergeMap(res => res), groupBy(el => el.class), mergeMap(group$ => group$.pipe(toArray())), // how in this place create something like this: [[{},{}], [{},{}], [{},{}]] shareReplay(1) )

Continue reading

Combine subject and observer in a single subscribe RxJs

Issue I have an Behavior Subject private usersSubject: BehaviorSubject<ActionedUser[]> = new BehaviorSubject([]); public usersChange: Observable<ActionedUser[]> = this.usersSubject.asObservable(); constructor() { } set updatedUsers(users: ActionedUser[]) { this.usersSubject.next(users); } and an Observable getCurrentUser(): Observable<WebAuthUser> { if (environment.production) { return this.http.get<WebAuthUser>(`${this.webAuthURL}/wauth/api/user`, { withCredentials: true

Continue reading

Jest/Rxjs – timeout when calling for subscription from a getter

Issue I have a service that updates an Rxjs Subject whenever a method in the service is called: @Injectable() export class AppAlertService implements IAppAlertService { private readonly _alertBehaviourSubject: Subject<IAlertConfiguration> = new Subject<IAlertConfiguration>(); public get alertConfiguration(): Observable<IAlertConfiguration> { return this._alertBehaviourSubject.asObservable(); }

Continue reading

Wait for observable to complete

Issue I have series of methods which are dependent on completion of other methods. process1(data: string) : Observable<string> { this.dataservice.process(data).subscribe( (response) => { return response.data; } ); } main(data: string) : string { var process1Data: string = process1(data); // I

Continue reading