Possible bug: Template variable not working after DynamicComponentLoader
I have a "dynamic" component that is loaded through a DynamicComponentLoader. In that dynamic component I'm trying to set a template variable. But for some reason this doesn't seem to get parsed by Angular. Eventhough the exact same thing works fine from the "main" component.
Here is an example of my problem: http://plnkr.co/edit/38mf2kWzH16RjTNcyLEO?p=preview
You should see two texts. A text in a h2 tag, which has a dynamic id attribute. This id attribute is successfully parsed
Then the Dynamic component is loaded underneath that h2 element. The div that says _I should have a dynamic ID_ has no id attribute anymore. For some reason the variable isn't parsed. Even worse, the entire id tag disappeared.
Bug?
Looks like a dup of #6223
You're right, seems like a duplicate. Didn't look hard enough.
The suggest "workaround" for loadAsRoot seems to solve this issue:
Inject ChangeDetectorRef and do:
setTimeout(() => changeDetector.detectChanges(), 0);
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.