我正在将一些组件转换为在 Angular 9中lazily loaded
使用。ivy compiler
这是我目前的代码:
<bulk-user-upload [visible]="bulkUserUploadVisible (fileUploaded)="onBulkUserUploadFileUploaded($event)">
我正在尝试将代码修改为:
<ng-container #bulkUserUpload></ng-container>
我想访问fileUploaded
子组件中存在的函数,以便可以在父组件上监听事件。
const { BulkUserUploadComponent } = await import('../bulk-user-upload/bulk-user-upload.component');
const bulkUserUploadFactory = this.cfr.resolveComponentFactory(BulkUserUploadComponent);
const { instance } = this.bulkUserUploadContainer.createComponent(bulkUserUploadFactory, null, this.injector);
instance.visible = true;
如何修改上面的代码以便我可以访问子函数?