SAP Spartacus Component-wrapper.directive.ts launch Component的三个参数

    科技2025-05-04  12

    拿到Component mapping后,使用subscribe fire this.launchComponent这个方法:

    launcher的三个输入参数:

    componentMappingviewContainerRefelementInjector

    首先根据injector和Component类型(字符串)拿到Component factory:

    再使用viewContainerRef创建Component:

    将创建好的Component ref通过next传递给下一个subscription(subscribe方法内部的next方法):

    要获取更多Jerry的原创文章,请关注公众号"汪子熙":

    汪子熙 认证博客专家 前端框架 Node.js SAP JerryWang,2007年从电子科技大学计算机专业硕士毕业后加入SAP成都研究院工作至今。Jerry是SAP社区导师,SAP中国技术大使。2020年5月下旬,Jerry做了脑部肿瘤的开颅切除手术,对编程和人生又有了新的感悟。
    Processed: 0.014, SQL: 8