The Most Important Thing You Need To Understand About Angular
--
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 — STAC — 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 STAC defines it’s own “template context” in full.
Hey folks! Recently there have been a great new surge of Angular buzz and for a good reason!
The new exciting times for Angular are upon us!
The Angular 13 finally removed old rendering engine called ViewEngine
and was therefore the first IVY
only release.
With this monstrous task being out of the way, Angular team can now focus on delivering new epic features like fully typed reactive forms, improvements for developer experience and the evolution of the framework itself!
The main effort on this field was embodied by the initiative to allow us to develop Angular applications without @NgModule
s and use the new stand-alone components (STACs) approach introduced in developer preview in Angular 14.
With Angular 15 released just now (17.11.2022) the STACs just came out of developer preview and became a development approach with first class support from Angular CLI and other parts of the framework.
Angular Stand-alone components represent…