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

如何在 angular16 的基座应用中通过路由加载子应用? #962

Closed
vanswang opened this issue Nov 13, 2023 · 6 comments
Closed
Labels

Comments

@vanswang
Copy link

github 仓库:https://github.com/vanswang/micro-app-angular-module

基础:基座应用和子应用都是 angular16 创建的。

问题:如何在 angular16 的基座应用中通过路由加载子应用?具体可看 github 仓库中的 angular16\host-ng16\src\app\app-routing.module.ts 文件内的 TODO

@bailicangdu
Copy link
Contributor

默认情况下,将micro-app元素插入到html中就可以渲染了,不需要特殊配置

@vanswang
Copy link
Author

默认情况下,将micro-app元素插入到html中就可以渲染了,不需要特殊配置

大佬是这样的,我是想在 html 里面不写 micro app 标签。然后在路由里面配置好之后通过点击菜单然后在 router outlet 里加载子应用,不知这样能否实现呢?

@bailicangdu
Copy link
Contributor

这两者没有关系,micro-app并不依赖路由

@vanswang
Copy link
Author

这两者没有关系,micro-app并不依赖路由

有点没太看懂,可能是我没解释清楚。是这样的,angular 的 routing 里面不是可以写一个 path 对应一个懒加载的 module 嘛,我想让第三方应用以这种形式加载。有个例子就是 module federation 里面有个 loadRemoteModule 的方式可以把第三方应用直接加载到主应用里面去。不知咱们 micro app 能有办法实现这个功能嘛?感谢大佬解答~

@bailicangdu
Copy link
Contributor

在micro-app1.0版本中已经不依赖于路由进行渲染,你可以把它当作iframe标签使用,甚至当成div标签,这些标签怎么写micro-app就怎么写

@vanswang
Copy link
Author

在micro-app1.0版本中已经不依赖于路由进行渲染,你可以把它当作iframe标签使用,甚至当成div标签,这些标签怎么写micro-app就怎么写

好嘞,大概理解了,感谢大佬解答~

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

No branches or pull requests

2 participants