SAP Spartacus List Component 里定义的待显示 Popover 内容,如何传递到 Popover Component 里的?
生活随笔
收集整理的這篇文章主要介紹了
SAP Spartacus List Component 里定义的待显示 Popover 内容,如何传递到 Popover Component 里的?
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
中心思想:這個傳遞以 Popover Directive 為橋梁。
PopoverComponent里的 content 屬性:
string 或者 TemplateRef,后者是 ng-template 即模板實例。
PopoverDirective 里的 cxPopover:
運行時,渲染出的 Popover,內容實際上是開發人員提供的,放在 List Component 里:
上圖 listHint 是 ng-template 定義的模板:
運行時,#listHint 代表的內容,首先通過 Popover Directive 的 cxPopover input,傳入到 Popover Directive 內部。
然后,Popover Directive 實例化 Popover Component 時,將 cxPopover 傳入 Popover Component 的 content input:
最后,通過 ng-content 結合 ngTemplateOutlet 將應用開發人員通過 ng-template 傳入的模板內容顯示出來:
<ng-container *ngIf="isTemplate"><ng-container *ngTemplateOutlet="content"></ng-container></ng-container>更多Jerry的原創文章,盡在:“汪子熙”:
總結
以上是生活随笔為你收集整理的SAP Spartacus List Component 里定义的待显示 Popover 内容,如何传递到 Popover Component 里的?的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 硬盘上的esp分区和msr分区_win1
- 下一篇: 英雄联盟手游佐伊怎么出装 lol手游佐伊