joeldenning / coexisting-angular-microfrontends

Multiple angular applications, coexisting in one page via single-spa.
MIT License
225 stars 155 forks source link

How event communication between sub-applications #38

Closed SmallProgramIndustry closed 4 years ago

SmallProgramIndustry commented 4 years ago

Hello! E.g: app1 Have login image

  1. app2 How to call app1 login?

  2. How to declare global variables (How to declare global variables for multiple items )?

  3. Can you give a simple example in the project?

    Reading the source code is clearer and more intuitive than the documentation, thank you!

joeldenning commented 4 years ago

app2 How to call app1 login?

Applications can communicate with each other by importing each other. See https://single-spa.js.org/docs/recommended-setup#inter-app-communication

How to declare global variables (How to declare global variables for multiple items )?

window.thing = 'value'

Can you give a simple example in the project?

There are a lot of examples at https://single-spa.js.org/docs/recommended-setup#inter-app-communication and https://single-spa.js.org/docs/examples