Exploring Angular DOM manipulation techniques using ViewContainerRef
Max, Wizard of the Web
6.3K43

Hi,

really great tutorial! But some things are still not clear to me!

In regards to TemplateRef and @ViewChild. They might replace and leave the <template>-Tag with a #comment in dem DOM tree. But what happens to the content of the <template>-Tag. In this case:

<template #tpl>
 <span>I am span in template</span>//WHAT HAPPENS TO THE SPAN?
 </template>

I can’t find the “<span>I am span in template</span>” when I console the templateRef variable (console.dir (this.tpl)), which I reference from @ViewChild(“tpl”) tpl: TemplateRef<any>;

In the logged object tree structure I can not find the excluded “<span>I am span in tempalte</span>” from the template.

This is some confusing part in ng4.