Skip to content

ng-content doesn't work with ng-container #8258

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

Closed
greenGoby opened this issue Nov 6, 2017 · 4 comments
Closed

ng-content doesn't work with ng-container #8258

greenGoby opened this issue Nov 6, 2017 · 4 comments

Comments

@greenGoby
Copy link

Bug, feature request, or proposal:

When you have an ng-container, transclusion doesn't work

What is the expected behavior?

I would expect the selector of the transclusion to pull in the element

What is the current behavior?

The element is not selected for

What are the steps to reproduce?

http://plnkr.co/edit/NqAbVgUclJkOSQCrS97H?p=preview

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

Found when putting md-error inside ng-container. md-input-field selector for md-error does not work
https://github.com/angular/material2/blob/9b4f4355bc89cb83295f10b8d1bea6ba3ab4d6d5/src/lib/form-field/form-field.html#L47

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

Angular 5

Is there anything else we should know?

@willshowell
Copy link
Contributor

Unfortunately, this is expected behavior in Angular. See #5263, #5292, and #6625.

@josephperrott
Copy link
Member

Closing as duplicate of the issues above:

This is a consequence of how content project works; only the top-level elements inside the container are projected, so adding the intermediate container make it not work. Something to potentially file an issue on for Angular Core.

@greenGoby
Copy link
Author

Sorry for that I actually meant to put that on the angular core one. Sounds like they are already aware though.

@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 Sep 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants