components icon indicating copy to clipboard operation
components copied to clipboard

config.componentFactoryResolver not been passed to ComponentPortal constructor in MatDialog._attachDialogContainer method

Open rpicone opened this issue 7 years ago • 3 comments

Bug, feature request, or proposal:

Bug.

What is the expected behavior?

The custom componentFactoryResolver of Material Dialog config parameter should be passed to ComponentPortal in _attachDialogContainer and _attachDialogContent methods.

What is the current behavior?

The custom componentFactoryResolver of Material Dialog config parameter is only passed to ComponentPortal in the _attachDialogContainer method.

What are the steps to reproduce?

Just provide a custom componentFactoryResolver to dialog.open.

What is the use-case or motivation for changing an existing behavior?

Can´t use the custom componentFactoryResolver to instantiate new components.

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

Angular: 8.2.13 Material: 8.2.3 All browsers affected

Is there anything else we should know?

I belive that to solve the problem we just need to change the line 264 (method _attachDialogContent) of dialog.ts, passing the custom componentFactoryResolver to ComponentPortal constructor. I did it locally and worked properly:

dialog.ts:

264: new ComponentPortal(componentOrTemplateRef, undefined, injector));

to

264: new ComponentPortal(componentOrTemplateRef, undefined, injector, config.componentFactoryResolver));

The method _attachDialogContainer was updated with this feature in https://github.com/angular/components/commit/565bd7da67ea5c789f14ae37d0f7fb6c85221593

rpicone avatar Nov 14 '19 10:11 rpicone

Hi - Could we get the fix for this merged? It looks like it's been approved. Thanks.

jponeill avatar Feb 15 '21 14:02 jponeill

Hi - Could we get the PR for this released? It looks like it's been approved. Thanks.

jponeill avatar Jun 09 '21 12:06 jponeill

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.