| 該構(gòu)造函數(shù)位于文件 popover.directive.ts 里: 
 第 11 行 cxPopOver Directive 施加到 button 元素上之后,運行時,cxPopOver Directive 的構(gòu)造函數(shù)觸發(fā)。其參數(shù),既有應(yīng)用程序定義的類型,比如 PositioningService, 也有框架使用的類型,比如 ElementRef,ViewContainerRef 等等。 
 
 
 
 
 我們注入這個實例的唯一目的,就是調(diào)用其 createComponent 方法。 
 const containerFactory = this.componentFactoryResolver.resolveComponentFactory( PopoverComponent ); this.popoverContainer = this.viewContainer.createComponent( containerFactory ); createComponent 方法需要輸入?yún)?shù)為 containerFactory,后者通過另一個注入?yún)?shù)實例 componentFactoryResolver 提供。componentFactoryResolver 可以理解成制造工廠的工廠函數(shù):需要的輸入?yún)?shù)是待生產(chǎn) Component 的定義,在這個例子里為 PopoverComponent: 
 而 createComponent 返回的數(shù)據(jù),類型為 ComponentRef, 包含了 PopoverComponent 的實例。 
 
 引入該屬性,是為了調(diào)用其 appendChild 方法,把創(chuàng)建好的 PopoverComponent 實例,添加到 DOM 樹中去。 
 
 在 SAP Spartacus 實現(xiàn)中沒有用到。 
 在 SAP Spartacus 實現(xiàn)中沒有用到。 負責(zé)元素 focus 相關(guān)的實現(xiàn)。 
 
 負責(zé)將新建的 PopoverComponent 實例中的 DOM 元素,添加到當(dāng)前 document 的 body 節(jié)點上。 
 | 
|  |