-
Notifications
You must be signed in to change notification settings - Fork 26.6k
Description
I'm submitting a bug report.
Current behavior
When a TemplateRef
is passed into another component and then stamped-out using the ViewContainerRef
, it appears to be injecting the TemplateRef
relative to the original location, not relative to the current ViewContainerRef
. I noticed this when trying something on my own. However, when I came across this behavior, I went and looked at the NG2 specs and it seems that your tests actually show the same behavior.
I took your specs and pasted them into a Plunkr: https://plnkr.co/edit/z6LBzUPkcfPHznGz66IW?p=preview
Notice that the TemplateRef
(green border) is being rendered next to the ViewContainerRef
(red border). I think the tests still pass because they are only checking the text output of the resultant view, not the actual DOM structure. The text output happens to still be correct, in this case, but the hierarchy is wrong .... I think.
Expected/desired behavior
I believe that the TemplateRef
should be injected into the ViewContainerRef
.
Please tell us about your environment:
Running on Chrome Version 50.0.2661.102 (64-bit)
Angular version: 2.0.0-beta.17 (Plunkr) and RC1 (locally) -- both show the same behavior.
Language: TypeScript