8000 rxLet with Multiple Observables · Issue #1108 · rx-angular/rx-angular · GitHub
[go: up one dir, main page]

Skip to content

rxLet with Multiple Observables #1108

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
mikerentmeister opened this issue Dec 2, 2021 · 3 comments
Open

rxLet with Multiple Observables #1108

mikerentmeister opened this issue Dec 2, 2021 · 3 comments
Labels
🃏 Demos Demos app related 📚 Docs Web Documentation hosted on github pages

Comments

@mikerentmeister
Copy link

Description

This is more of a question than a bug report. Using the ngIf hack you can do this sort of in your component templates to be able to use 2+ observables in multiple places within your template.

<ng-container
  *ngIf="{
    hasSelections: (screenManager.hasSelections$ | async),
    isSaving: (screenManager.isSaving$ | async)
  } as vm"
>
    ... code here
</ng-container>

Questions:

  1. Are you able to use @rx-angular/template to do something like this, with all of the performance gains of the library still in tact? Keeping in mind that there are some pages where I have 8+ observables, I don't want to have to do an *ngLet for each one.
  2. If yes, how would you structure it?
@mikerentmeister mikerentmeister changed the title Title of the bug ngLet with Multiple Observables Dec 2, 2021
@mikerentmeister mikerentmeister changed the title ngLet with Multiple Observables rxLet with Multiple Observables Dec 3, 2021
@BioPhoton BioPhoton added 🃏 Demos Demos app related 📚 Docs Web Documentation hosted on github pages labels Dec 7, 2021
@BioPhoton
Copy link
Member

We have this operator:

https://github.com/rx-angular/rx-angular/blob/master/libs/cdk/state/src/lib/accumulateObservables.ts#L31

Would you be interested in creating docs for it?

@BioPhoton
Copy link
Member

related to #1175

@malua
Copy link
malua commented May 11, 2023

Hey, I just wanted what the correct way to this now would be. Is it still the accumulateObservables operator? I was wondering, because it is in the internales/core package.
If this cart template which needs promotions, prices and allocations:

<ng-container
        *ngIf="{
          promotions: promotions$ | async,
          prices: prices$ | async,
          allocations: allocations$ | async
        } as data"
      >

Can I still do that in the template with rxLet or should I combine that in the class with accumulateObservables?

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🃏 Demos Demos app related 📚 Docs Web Documentation hosted on github pages
Projects
None yet
Development

No branches or pull requests

3 participants
0