Skip to content

Shadow DOM Emulation: two components in a template, the second does not get content projection #1058

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
jelbourn opened this issue Mar 23, 2015 · 5 comments · Fixed by #1621

Comments

@jelbourn
Copy link
Member

I have two components: MdButton and MdAnchor. Their selectors are [md-button]:not([href]) and [md-button][href], respectively. They both use the same template:

<link href="../button.css" rel="stylesheet">
<span class="md-button-wrapper"><content></content></span>

I have a demo where I render out some buttons and some anchors. It looks something like this:

<button md-button>BUTTON</button>
<a md-button href="http://google.com">ANCHOR</a>

Whichever component is second on the page does not receive content projection. Instead, the placeholder <script> tags are still there.

You can see this issue locally:

git fetch https://github.com/jelbourn/angular.git material-2
get checkout tags/projection-bug
npm install gulp-sass
npm install gulp-autoprefixer
gulp build.material
gulp serve.js.dev

Then visit http://localhost:8000/angular2/src/material/components/button/demo/?
You can see that the anchors do not have their content projected, while the buttons do. If you remove all of the buttons and leave only the anchors, they work fine. Re-add another button after the anchors, and then that button will have the problem.

@mhevery mhevery added this to the M7: GT Customer milestone Mar 26, 2015
@vsavkin
Copy link
Contributor

vsavkin commented Mar 26, 2015

I think since @tbosch and @yjbanov moved/moving shadow dom emulation into the render module, one of them should take look.

@jelbourn
Copy link
Member Author

jelbourn commented Apr 9, 2015

@mhevery this is still happening after the render layer changes from @tbosch. Who's the best person to take a look?

@jelbourn jelbourn changed the title Two components in a template, the second does not get content projection Shadow DOM Emulation: two components in a template, the second does not get content projection Apr 9, 2015
@mhevery
Copy link
Contributor

mhevery commented Apr 10, 2015

@tbosch is still the person, if he is busy maybe @yjbanov can help (or even @vsavkin )

@jelbourn
Copy link
Member Author

@tbosch Tried this just now on current master, the issue is still present.

tbosch added a commit to tbosch/angular that referenced this issue Apr 30, 2015
This is needed as the compiler changes templates during compilation
and we are caching templates in the `TemplateLoader`.

Closes angular#1058
tbosch added a commit to tbosch/angular that referenced this issue Apr 30, 2015
This is needed as the compiler changes templates during compilation
and we are caching templates in the `TemplateLoader`.

Closes angular#1058
tbosch added a commit to tbosch/angular that referenced this issue Apr 30, 2015
This is needed as the compiler changes templates during compilation
and we are caching templates in the `TemplateLoader`.

Closes angular#1058
@tbosch tbosch removed the in progress label May 1, 2015
@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 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants