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

feat(cdk/portal): allow specifying injector for template portal #24554

Merged
merged 1 commit into from
Mar 9, 2022

Conversation

mmalerba
Copy link
Contributor

@mmalerba mmalerba commented Mar 8, 2022

No description provided.

@mmalerba mmalerba added the target: major This PR is targeted for the next major release label Mar 8, 2022
@mmalerba mmalerba requested a review from crisbeto March 8, 2022 22:04
@mmalerba mmalerba requested a review from andrewseguin as a code owner March 8, 2022 22:04
Copy link
Member

@crisbeto crisbeto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mmalerba mmalerba requested a review from a team as a code owner March 9, 2022 06:47
@crisbeto crisbeto added the action: merge The PR is ready for merge by the caretaker label Mar 9, 2022
@crisbeto crisbeto merged commit f91b98f into angular:master Mar 9, 2022
forsti0506 pushed a commit to forsti0506/components that referenced this pull request Apr 3, 2022
Comment on lines +184 to +186
const viewRef = this._viewContainerRef.createEmbeddedView(portal.templateRef, portal.context, {
injector: portal.injector,
});
Copy link
Contributor

@lekhmanrus lekhmanrus Apr 5, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should it be

    const viewRef = this._viewContainerRef.createEmbeddedView(
      portal.templateRef,
      portal.context,
      portal.injector ? { injector: portal.injector } : undefined
    );

instead?

See StackBlitz. When we click Render template portal button it throws an error:
image

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't reproduce this error locally in our dev app. I think the problem is that your Stackblitz is running v14 of the CDK against v13 of the Framework which doesn't support the injector option yet.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@crisbeto, right. Sorry about that.

@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 May 7, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker target: major This PR is targeted for the next major release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants