【发布时间】:2022-04-13 16:01:06
【问题描述】:
我是 SPA 新手,我正在尝试扩展 PDP 以通过单击按钮将某些数据发送到外部 API。
我已经能够在app.component.ts 中使用@spartacus/storefront 中的ProductDetailsOutlets 检索产品对象
import { Component } from '@angular/core';
import { ProductDetailOutlets } from '@spartacus/storefront';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss'],
})
export class AppComponent {
title = 'wishlistStore';
pdpOutlets = ProductDetailOutlets;
}
app.component.html 看起来像这样。
<cx-storefront></cx-storefront>
<ng-template [cxOutletRef]="pdpOutlets.SUMMARY" let-product>
<!-- {{ product | json }} -->
<app-wishlist-button [productDetails]="product"></app-wishlist-button>
</ng-template>
这里的问题是有没有一种方法可以在 Spartacus 中使用上述方法访问/检索当前登录的用户对象以及如何?
提前致谢!
【问题讨论】:
标签: angular spartacus-storefront