这段代码比较复杂。逐一分析:
this.cmsStructureConfigService.getComponentsFromConfig(ids):
this.getComponentById的实现: 从内存里返回:
再通过of封装成Observable. 这个Observable再调用pipe组装一个switchMap函数。
switchMap的函数实现:检查是否存在不是从configuration里加载的Component,如果没有,直接用Observable包装内存里的Component;如果有,进入49行的IF分支去取:
要获取更多Jerry的原创文章,请关注公众号"汪子熙":