- SAP 电商云 Spartacus UI ComponentDa
- SAP 电商云 Spartacus UI 的 Product C
- 网站上的 breadcrumb 使用场景浅析
- SAP UI5 sap.ui.vk 命名空间内的控件介绍
- HTML 按钮(button)的 disable 属性和 dis
- SAP 电商云 Spartacus UI 产品搜索结果的设计明细
- SAP 电商云 Spartacus UI Proxy Facad
- Angular @Injectable 注解的工作原理浅析
- 关于 Angular 部署以及 index.html 里 bas
- SAP 电商云 Spartacus UI 从 CMS 取回 sl


为什么 this.componentService.getItems 最后就触发到
Component-data.provider.ts 工厂函数的执行了?

29行的 getService:


getService 的实现在第 70 行,又会调用到第 79 行的 getContext:

这里的 componentData,就和之前这篇文章如何在 SAP 电商云 Spartacus UI 里访问 CMS Component data 数据介绍的内容串联起来了。
输入参数:

首先明确,为什么 defer 里的工厂函数会被执行?一定是因为 defer 返回的 Observable 在某处被 subscribe 了。
getItems -> getService -> getContext -> this.componentData.data$
因为 getItems 被 async pipe 执行,所以 this.componentData.data$ 被 subscribe.
更多Jerry的原创文章,尽在:"汪子熙":

网友评论