- 在SAP Spartacus产品明细页面用outlet显示自定义
- SAP Spartacus产品明细页面用Observable显示
- SAP 电商云 Spartacus UI 产品搜索结果的设计明细
- 使用outlet在SAP Spartacus的页面添加自定义HT
- SAP Spartacus Product 明细页面 meta
- 如何在 SAP Spartacus 产品明细页面添加自定义 UI
- SAP Spartacus的基于outlet的页面扩展
- SAP 电商云 Spartacus 产品明细页面的 pageCo
- SAP 电商云 Spartacus 产品明细页面的 canAct
- 自定义SAP Spartacus的产品搜索API参数
首先创建一个新的Angular module和Component:

这个新的module,因为要使用Outlet功能,所以需要从@Spartacus/storefront里导入OutletRefModule,以及导出我们自己实现的MyOutletsComponent以便让外界消费。

MyOutletsComponent的实现:
在构造函数里注入currentProductService, 调用getProduct方法异步读取当前product属性,存储在属性product$里:

在这个Component的html里,显示product$的值:

<ng-template cxOutletRef="ProductDetailsPageTemplate" cxOutletPos="before" let-model>
<h1>Jerry</h1>
<p>Product: {{ product$ | async | json }}</p>
</ng-template>

最后别忘了把Component的selector标签加到app Component的html里:

最后的效果:

网友评论