Exploring Angular DOM manipulation techniques using ViewContainerRef
Maxim NgWizard K
1.3K13

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.

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.