I am changing *this.subscription1 = this.route.paramMap* to *this.subscription2 
= combineLatest([this.route.params,this.route.queryParams]* and want to 
keep all the logic as *this.subscription1 = this.route.paramMap* except 
want to add one more condition in *this.subscription2 = 
combineLatest([this.route.params,this.route.queryParams]* if queryParams 
has mode "dealNumber" then I want to return 
of(this.myService.loadDealByNumber(dealNumber)); else I want to return 
of(this.myService.loadDealById(dealId)); 

this.subscription1 = this.route.paramMap .pipe( map(params => params.get(
'deal_id')), mergeMap(dealId => { if (this.dealForm) { 
this.dealForm.form.markAsPristine(); 
} if (dealId !== 'new') { //Here I want to check if queryParams has mode 
"dealNumber" then I want to return 
of(this.myService.loadDealByNumber(dealNumber)); else I want to return 
of(this.myService.loadDealById(dealId)); } else { return this.abcDealer$.pipe( 
tap((dealer: DealerModel) => { this.myService.newDeal(dealer); }) ); } }) ) 
.subscribe(); this.subscription2 = combineLatest([ this.route.params, 
this.route.queryParams 
]).pipe( tap(res => console.log('combineLatest - params - queryParams', 
res)), map(([params, queryParams]) => ({ params, queryParams })) ) 
.subscribe(); 

-- 
You received this message because you are subscribed to the Google Groups 
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to angular+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/angular/66078251-44bc-4a84-a180-f9f41481c85bn%40googlegroups.com.

Reply via email to