获取slot内的cms组件数据

Obtaining cms component data inside slot

我们正在尝试为包含多个 CMSLinkComponents 的现有广告位 (SiteLinks) 设置样式。我们无法获取组件的完整数据,因为当我们在 ng-template 上使用 let-[var] 语法时,我们只收到 uidtypeCode

是否有示例说明如何访问这些组件的完整数据,而无需根据 uid 单独请求它们?

<ng-template cxOutletRef="SiteLinks" let-data>
  <pre>{{ data.components$ | async | json }}</pre>
</ng-template>

上下文模型取决于插座的使用位置。在您的情况下,上下文是一个 Slot 模型,在这个层次结构级别上,您只有组件列表而不是它们的数据,因为您应该单独获取数据。

我相信,这种方法会奏效:

<ng-template cxOutletRef="SiteLinks" let-slot>
  <ng-container *ngFor="let component of (slot.components$ | async)">
    <ng-container [cxComponentWrapper]="component"></ng-container>
  </ng-container>
</ng-template>

cxComponentWrapper 在需要处理嵌套组件的情况下也很有用。