Questions tagged operators

Explore the latest questions and answers asked by our top developers.

Not operator usecase in javascript [duplicate]

In my angular app, i encountered a not operator(!) at strange place. I know optional chaining operator(?.) in js and this looks similar but i don’t know how this one works. Anybody knows whats going on below code with !. event.chipInput!.clear(); Source: Angular Questions

By SoulOfJack
Published
Categorized as angular, javascript, operators Tagged , ,

Angular combine and transform multiple http requests with forJoin Rxjs operator

I am combining multiple http requests with forkJoin rxjs operator. fetchUsers() { const userIds = [1, 2, 3]; const url = ‘https://jsonplaceholder.typicode.com/users’; forkJoin(userIds.map(id => this.http.get(`${url}/${id}`))).subscribe( console.log ); } So, then I subscribe I get three objects, but I want to mutate that objects and get structure like this [{id:1, user: Object}, {id:2, user: Object}, {id:3, […]

By zana10
Published
Categorized as angular, fork-join, operators, rxjs Tagged , , ,

How to synchronize 3 observables?

I have 3 observables a, b and c that I call on page load to get the needed data. b is dependent on a. c is independent. I want to know when I have fetched data from all of them so I can set the is loading to false. Also what would be best practice […]

By user2650880
Published
Categorized as angular, operators, rxjs Tagged , ,

operator !! in Javascript (angular) [duplicate]

I met this line of code and have no idea what ‘!!’ is: isLoggedIn() { return !!this.getJwtToken(); } can anyone please help? Source: Angular Questions

By toan
Published
Categorized as angular, javascript, operators, syntax Tagged , , ,

Split every word in observable (debounce untill space?)

This is the script that speaks while you’re typing (starts when you don’t type for 0,5 seconds) this.queryField.valueChanges.pipe( debounceTime(500), distinctUntilChanged(), switchMap(x=>this.translateService.translate({q: x, source: ‘en’, target: ‘ru’})) ).subscribe(response => this.speechService.speak(response, 1, ‘Google русский’)); How do I split it into words (or sentences) and let it speak every word only once? Source: Angular Questions

By Oba Api
Published
Categorized as angular, observable, operators Tagged , ,

Explanation about RXJS operator "withLatestFrom"

Can someone explain what does withLatestFrom do? I read the documentation but I’m not sure I understood. Thank you Source: Angular Questions

By Matt
Published
Categorized as angular, operators, rxjs Tagged , ,

How to turn an Observable of a type into an Observable of another type

I have an Angular application that uses NGRX to manage the application state. I have a selector that return me an Observable. export const mySelector = createSelector(state, (state: IState) => state.field.array); The Observable returned has this format: {name:string; age:number}[] What I need to do is to turn that data format in another data format, for […]

By Matt
Published
Categorized as angular, operators, rxjs, typescript Tagged , , ,

Make a mat-chip-list that lets you write text between chips

I’m trying to recreate something like the Google Data Studio calculated fields formula builder. You can see an example here: https://youtu.be/suAa8QtPBJY?t=123. I’ve included the timestamp with the exact example of what I’m trying to recreate. Basically a textarea that has an autocomplete feature and lets you add multiple metrics/chips between arithmetic operators (like parentheses, SUM, […]

Angular Rxjs operator that help us start emitting when some variable changes

I just want to know if is there some rxjs operator that can delay my observable to start emitting when my variable is set to true. Something like this on Angular: loading: boolean; constructor () { this.subscriptions.push( this._messageService.loadMyEvent$.pipe( // here the operator that emitts data when loading is set to true ).subscribe(response => { // […]

By Amos Isaila
Published
Categorized as angular, javascript, operators, rxjs, typescript Tagged , , , ,

Error: no element in sequence. Rxjs onErrorResumeNext() and first()

First of all, I’ve googled lots of questions about Error: no element in sequence. To replace first() with take(1) can solve my problem, but for me it’s a workaround, not a fix. I use Angular 8 in my project. CODE loadResources(resources: LocalizeResources = null) { // some other codes… const urls = [ `json/i18n-resources${this.locale ? […]

By Liem
Published
Categorized as angular, angular8, operators Tagged , ,

Still Have Questions?


Our dedicated development team is here for you!

We can help you find answers to your question for as low as 5$.

Contact Us
faq