Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Nested multiple transclude fails #16159

Closed
harm-less opened this issue Aug 9, 2017 · 4 comments
Closed

Nested multiple transclude fails #16159

harm-less opened this issue Aug 9, 2017 · 4 comments

Comments

@harm-less
Copy link

harm-less commented Aug 9, 2017

I'm submitting a...


[ ] Regression (a behavior that used to work and stopped working in a new release)
[x] Bug report  
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question

Current behavior

I like the idea of multiple transcluding, but it seems I've run into a possible bug when transclusion happens from a parent component. The provided error is as follows:
Required transclusion slot 'titleSlot' was not filled.

Minimal reproduction of the problem with instructions

https://plnkr.co/edit/BrPCuekwwbBQARcCmodo?p=preview

Expected behavior

I expect the Plunker to work as expected because I don't understand the difference between using only the ng-child component with its multiple transclusion slots or "sending" the transclusion slots down to the child using another transclude. Did I miss something here?

What is the motivation / use case for changing the behavior?

The code I'm writing would be much more DRY if this works because it allows me to combine/wrap some of my components into bigger components.
Another solution I had is to replace the templateUrl using attributes, but that didn't work out (#11144).

Environment


Angular version: 1.6.1 (but the Plunker is using 1.6.6)

Browser:
- [x] Chrome (desktop) version Version 59.0.3071.115 (Official Build) (32-bit)
- [ ] Chrome (Android) version XX
- [ ] Chrome (iOS) version XX
- [ ] Firefox version XX
- [ ] Safari (desktop) version XX
- [ ] Safari (iOS) version XX
- [ ] IE version XX
- [ ] Edge version XX
 
@gkalpak
Copy link
Member

gkalpak commented Aug 10, 2017

Unfortunately, this is currently not supported. See #8914 (comment) for some more details on what is going on under the hood.
I will close this as a duplicate of #8914, which has more context.

@gkalpak gkalpak closed this as completed Aug 10, 2017
@harm-less
Copy link
Author

harm-less commented Aug 11, 2017

I think I understand, thanks for the clarification. The solution I'm doing right now is not a pretty and DRY, but it works nonetheless. I basically moved the transclusion up one parent element so I've to give the directive including the multi-transclusion to the place where I can specify the differences between various scenarios.

Does Angular 2 have this feature?

@gkalpak
Copy link
Member

gkalpak commented Aug 11, 2017

Yes, this should work in Angular. Its projection (that's what transclusion is called in Angular) is quite differently implemented and more flexible.

@harm-less
Copy link
Author

Sounds good! I was indeed very surprised it wasn't working the way I expected because it sounds essential to the whole purpose of transclusion.
In a few months we're going to attempt to migrate to Angular 2 because I feel like especially large applications benefit from it. So I can't wait to be blown away by all the good things I hear about it ;)

Thanks for the information/support.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants