The Angular "Template Context" is a practically useful mental model, which once internalized, will be your main guide on the journey to build the best possible Angular applications!
Foreword
This article is pretty long, but donât worry, itâs not because Angular is just soooo damn complicated⌠Itâs because weâre painting a very board picture and looking at it from all the imaginable angles so that in the end you will end up with 100% full understanding of the topic!
In theory, you could just search for the heading saying âTemplate contextâ , but I would strongly advise to check the whole thing đ
TLDR; In Angular, template related things declarables ( components, directives and pipes ) that use each other in their templates have to be part of THE SAME âtemplate contextâ which is defined by @NgModule
(or the component itself when using new stand-alone components SAC approach), application then usually has multiple âorigin template contextsâ, namely the eager ( root ) one and then for every lazy loaded @NgModule
. On the other hand, every SAC defines its own âtemplate contextâ in full.