Skip to content

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

Closed
@rpicone

Description

@rpicone

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
565bd7d

Metadata

Metadata

Assignees

Labels

P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: material/dialog

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions