umijs / qiankun

📦 🚀 Blazing fast, simple and complete solution for micro frontends.
https://qiankun.umijs.org
MIT License
15.72k stars 2.01k forks source link

[Feature Request] 需要一个angular作为主应用的示例 #755

Open oridark opened 4 years ago

oridark commented 4 years ago

Background

公司项目是纯angular的,几个项目需要融合,主应用也是angular

Proposal

Describe the solution you'd like, better to provide some pseudo code.

Additional context

Add any other context or screenshots about the feature request here.

waltbest2 commented 4 years ago

我理解就是主应用写个空的模板匹配所有路由,然后由qiankun按子应用路由渲染[innerHtml]

waltbest2 commented 4 years ago

我试了angular作为主应用,能加载,但是子应用的angular感觉没有执行。页面显示为空。这个大家知道什么原因吗?

已经进入了 runAfterFirstMounted

image

Xiaoxiasuper commented 4 years ago

runAfterFirstMounted

同问呐

waltbest2 commented 4 years ago

问题已经解决,手工执行脏检查就行了 changeDetectorRef.detectChanges();

KellenHe commented 4 years ago

@waltbest2 请问有示例吗,官网的示例angular执行报错。在什么位置执行changeDetectorRef.detectChanges();

waltbest2 commented 4 years ago

@waltbest2 请问有示例吗,官网的示例angular执行报错。在什么位置执行changeDetectorRef.detectChanges();

官网实例是子应用,target改成es5就可以了。

changeDetectorRef.detectChanges();根据你自己的代码安排,在主应用的render函数中回填content后,直接加这一句就行了。

chengxuanxie commented 4 years ago

做了一个angular9为主应用,angular9/angularjs为子应用的示例,正好符合issue的要求。

https://github.com/chengxuanxie/qiankun-angular-angularjs/blob/master/README.md