sorting - How to sort an Observable with Observable parameters ? rxjs -


i trying modify , sort list. noob @ :(

i able 'combinelatest' problem have modify array function below 'groupbydateandtournament'. outcome:

  1. create observable of list , sorting parameters (favoritetournaments, teamranks)
  2. modify list 'groupbyandtournament' if observable list has changed
  3. sort favorite if obsevable favoritetournament has changed
  4. sort ranks if observable teamrank has changed

        this.subscription =       this.matchesservice.getupcoming()     .merge(     this.favoriteservice.getfavoritetournaments().flatmap((data) => {         return {'favoritetournaments': data}     }),     this.teamsservice.getteamranking().flatmap((data) => {         return {'teamranks': data}     })  ).scan((acc, curr) => {     let upcomingmatches;     if (curr.upcoming) {         upcomingmatches = this.groupbydateandtournament(curr);     }     if (curr.favoritetournaments) {         upcomingmatches = this.sortbyfavorite(curr)     }      if (curr.teamranks) {         upcomingmatches = this.sortbyrank(curr);     }     return upcomingmatches;  })     .subscribe() 

so managed combinelatest

observable.combinelatest(         this.matchesservice.getupcoming().map((data)=> this.upcomingservice.combineupcomings(data)),         this.favoriteservice.getfavoritetournaments(),         this.teamsservice.getteamranking(),         (matches, favoritetournaments, teamranks) => this.upcomingservice.prepareupcomingmatches(matches, favoritetournaments, teamranks)     ).subscribe((data)=>         this.ngzone.run(() => {             this.upcomingmatches = data;             this.loading = false;         })     ); 

it still has issues.prepareupcomingmatchesfunction reruning when of observables changed.


Comments

Popular posts from this blog

php - How to display all orders for a single product showing the most recent first? Woocommerce -

asp.net - How to correctly use QUERY_STRING in ISAPI rewrite? -

angularjs - How restrict admin panel using in backend laravel and admin panel on angular? -