rxjs

Angular/Rxjs pipe async does not work with ssr?

陌路散爱 提交于 2020-12-30 17:20:36
问题 I have an issue with the async pipe running on SSR. there are no errors, only an infinite loop (it seems that the server is waiting for the observable to be resolved). I am using: @nestjs/ng-universal Angular 9 Firebase Rxjs A simple case like this works: <p>{{ observable | async }}</p> But using structural directives do not work: ngIf <p *ngIf="(observable$ | async) > 5">{{ observable$ | async }}</p> Ngfor <p *ngFor="let item of items | async">{{ item }}</p> Using async is a good practice

Angular/Rxjs pipe async does not work with ssr?

核能气质少年 提交于 2020-12-30 17:19:47
问题 I have an issue with the async pipe running on SSR. there are no errors, only an infinite loop (it seems that the server is waiting for the observable to be resolved). I am using: @nestjs/ng-universal Angular 9 Firebase Rxjs A simple case like this works: <p>{{ observable | async }}</p> But using structural directives do not work: ngIf <p *ngIf="(observable$ | async) > 5">{{ observable$ | async }}</p> Ngfor <p *ngFor="let item of items | async">{{ item }}</p> Using async is a good practice

Angular/Rxjs pipe async does not work with ssr?

痞子三分冷 提交于 2020-12-30 17:18:21
问题 I have an issue with the async pipe running on SSR. there are no errors, only an infinite loop (it seems that the server is waiting for the observable to be resolved). I am using: @nestjs/ng-universal Angular 9 Firebase Rxjs A simple case like this works: <p>{{ observable | async }}</p> But using structural directives do not work: ngIf <p *ngIf="(observable$ | async) > 5">{{ observable$ | async }}</p> Ngfor <p *ngFor="let item of items | async">{{ item }}</p> Using async is a good practice

Angular 10, TypeError in browser console, but no error in build

假如想象 提交于 2020-12-14 23:52:50
问题 No code changes done, upgraded to Angular 10, everything works except a feature. There were no build errors, but in browser console able to see below error. I guess this may be related to angular.core, rxjs, but unclear..appreciate your help. core.js:4197 ERROR TypeError: templateRef.createEmbeddedView is not a function at ViewContainerRef.createEmbeddedView (core.js:10092) at NgTemplateOutlet.ngOnChanges (ng_template_outlet.ts:65) at NgTemplateOutlet

Angular 10, TypeError in browser console, but no error in build

跟風遠走 提交于 2020-12-14 23:40:10
问题 No code changes done, upgraded to Angular 10, everything works except a feature. There were no build errors, but in browser console able to see below error. I guess this may be related to angular.core, rxjs, but unclear..appreciate your help. core.js:4197 ERROR TypeError: templateRef.createEmbeddedView is not a function at ViewContainerRef.createEmbeddedView (core.js:10092) at NgTemplateOutlet.ngOnChanges (ng_template_outlet.ts:65) at NgTemplateOutlet

RXJS polling without recursion

笑着哭i 提交于 2020-12-13 11:42:32
问题 Server is processing multiple request at the same time. Call the service to check the status of each request. Service accepts list of ids and will give status of each id as following { id: number, status: number}; Status 1 is pending and 2 is complete Need to poll on all the pending request ids until all requests are complete I have a following recursive solution but need a concise RXJS solution for it poll(requestIds: Array<number>): void { if (requestIds.length > 0) { callService(requestIds

RXJS polling without recursion

喜欢而已 提交于 2020-12-13 11:41:29
问题 Server is processing multiple request at the same time. Call the service to check the status of each request. Service accepts list of ids and will give status of each id as following { id: number, status: number}; Status 1 is pending and 2 is complete Need to poll on all the pending request ids until all requests are complete I have a following recursive solution but need a concise RXJS solution for it poll(requestIds: Array<number>): void { if (requestIds.length > 0) { callService(requestIds

Chain Dependant Observables in Resolver

二次信任 提交于 2020-12-13 07:09:54
问题 I have a resolver that needs to fetch data from two dependant Apis before the page is loaded. The second call is defined by the result of the first one, so I try to chain the two observables and need to return the second one at the end of the resolver. Before I tried to chain the observables I had: resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<MySecondObservable> { const observable1 = this.myService.getFirstDataSet(); observable1.subscribe( firstDataSet =>

How to subscribe array of Observable Forkjoin not working

笑着哭i 提交于 2020-12-13 03:43:10
问题 I am trying to do multiple HTTP requests in angular using forkjoin.But when I subscribe to Observable it doest not give any response. let data = this.email.map((email) => this.get_student_service.get_student_by_email_id(email) ); forkJoin([data]).subscribe((res) => { console.log(res); }); console.log('Execute'); Here is my service get_student_by_email_id(email) { return this.fire_store .collection('User', (ref) => ref.where('email', '==', email)) .valueChanges(); } 回答1: Ok, if you're getting

How to subscribe array of Observable Forkjoin not working

喜欢而已 提交于 2020-12-13 03:40:48
问题 I am trying to do multiple HTTP requests in angular using forkjoin.But when I subscribe to Observable it doest not give any response. let data = this.email.map((email) => this.get_student_service.get_student_by_email_id(email) ); forkJoin([data]).subscribe((res) => { console.log(res); }); console.log('Execute'); Here is my service get_student_by_email_id(email) { return this.fire_store .collection('User', (ref) => ref.where('email', '==', email)) .valueChanges(); } 回答1: Ok, if you're getting