Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
rpicone opened this issue Nov 14, 2019 · 3 comments · Fixed by #17710
Assignees
Labels
area: material/dialog P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent

Comments

@rpicone
Copy link

rpicone commented Nov 14, 2019

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

@crisbeto crisbeto self-assigned this Nov 15, 2019
@crisbeto crisbeto added has pr P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent target: patch This PR is targeted for the next patch release labels Nov 15, 2019
crisbeto added a commit to crisbeto/material2 that referenced this issue Nov 15, 2019
… content

Currently the `ComponentFactoryResolver` from the dialog config is only used for the dialog container. These changes switch to also use it for the dialog content component.

Fixes angular#17702.
jelbourn pushed a commit that referenced this issue Nov 20, 2019
… content

Currently the `ComponentFactoryResolver` from the dialog config is only used for the dialog container. These changes switch to also use it for the dialog content component.

Fixes #17702.
crisbeto added a commit to crisbeto/material2 that referenced this issue Dec 15, 2019
… content

Currently the `ComponentFactoryResolver` from the dialog config is only used for the dialog container. These changes switch to also use it for the dialog content component.

Fixes angular#17702.
crisbeto added a commit to crisbeto/material2 that referenced this issue Aug 12, 2020
… content

Currently the `ComponentFactoryResolver` from the dialog config is only used for the dialog container. These changes switch to also use it for the dialog content component.

Fixes angular#17702.
crisbeto added a commit to crisbeto/material2 that referenced this issue Jan 5, 2021
…ve dialog content

Currently the `ComponentFactoryResolver` from the dialog config is only used for the
dialog container. These changes switch to also use it for the dialog content component.

Fixes angular#17702.
@jponeill
Copy link

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

@crisbeto crisbeto removed the target: patch This PR is targeted for the next patch release label Apr 6, 2021
@jponeill
Copy link

jponeill commented Jun 9, 2021

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

crisbeto added a commit to crisbeto/material2 that referenced this issue Mar 1, 2022
…ve dialog content

Currently the `ComponentFactoryResolver` from the dialog config is only used for the
dialog container. These changes switch to also use it for the dialog content component.

Fixes angular#17702.
crisbeto added a commit that referenced this issue Mar 1, 2022
…ve dialog content (#17710)

Currently the `ComponentFactoryResolver` from the dialog config is only used for the
dialog container. These changes switch to also use it for the dialog content component.

Fixes #17702.
crisbeto added a commit that referenced this issue Mar 1, 2022
…ve dialog content (#17710)

Currently the `ComponentFactoryResolver` from the dialog config is only used for the
dialog container. These changes switch to also use it for the dialog content component.

Fixes #17702.

(cherry picked from commit e1f4ba9)
@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Apr 1, 2022
forsti0506 pushed a commit to forsti0506/components that referenced this issue Apr 3, 2022
…ve dialog content (angular#17710)

Currently the `ComponentFactoryResolver` from the dialog config is only used for the
dialog container. These changes switch to also use it for the dialog content component.

Fixes angular#17702.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: material/dialog P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent
Projects
None yet
4 participants