Skip to content
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

Angular ngzone relations #46

Open
refactorTractor opened this issue Mar 18, 2024 · 1 comment
Open

Angular ngzone relations #46

refactorTractor opened this issue Mar 18, 2024 · 1 comment

Comments

@refactorTractor
Copy link

Hi!

Your article mentions that to avoid problems, one should share NgZone between angular microfrontends. What are those problems that could arise?

Would it be a good alternative to fork the host's zone, and make the remote use that? I imagine that the host's wrapper component could inject ngZone, call run, inside the run callback fork the zone and then append the angular element running in that zone. Looking through the code I see that NgZone of the mfe would just fork the current zone - which is itself a fork of the host's zone.

(Sadly I have a browser API to decorate for remotes only)

@refactorTractor
Copy link
Author

refactorTractor commented Mar 18, 2024

As I read about it, forking the host's zone would not be good, because if I patch in the child zone that will decorate the parent zone's execution as well (not good if I want to patch only the remote's zone). My alternative is then forking from the host's parent (I could achieve that by creating and appending the remote's element in a runOutsideAngular callback). I'm guessing the downside to that might be that events between remote and host don't trigger each other's change detection? Or is there some other pitfall?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant