
Components can be created at runtime from a type reference, either declaratively in a template or imperatively in code. We look at the view-switcher example we're going to build and walk through the starter code already in place.
NgComponentOutlet is a structural directive that renders a component from a type expression. We explore its syntax, available bindings, and how Angular manages the component's lifecycle automatically.
We use ngComponentOutletInputs to pass the products list into the active presenter. Each view reads the items through its signal input and renders the data.
NgComponentOutlet has no output binding mechanism. We learn how to create a custom Injector with an injection token and pass it via ngComponentOutletInjector to communicate actions back to the parent.
We define a ViewPicker interface requiring an options input and a value model. We create an injection token for the picker component type and provide a default SelectPickerComponent.
We inject the picker type from the token and create it using ViewContainerRef.createComponent with inputBinding for the view options and twoWayBinding for the selected view. The picker now drives the presenter swap
Angular provides inputBinding, outputBinding, and twoWayBinding helpers to wire up dynamic components at creation time. We explore the syntax and see how they replace the old setInput approach.
Mastering Angular components is what separates average developers from true professionals.
This course is focused on turning you into an expert in component authoring in Angular 21. You’ll go beyond basic components and learn the advanced building blocks that Angular provides:
element directives,
structural directives,
microsyntax,
content projection,
templates,
dynamic view composition
and more importantly, how they all fit together into powerful, real-world patterns.
At the core of this course is a powerful pattern: Composable Components. Instead of building components that try to do everything with endless inputs and interfaces, you’ll learn how to design a lean “core” component that can be extended and customized using external pieces: templates, directives, and projected content. This approach keeps your components simple, while allowing them to grow in capability without becoming complex or fragile. This makes your components flexible across scenarios, without becoming bloated with options.
Instead of creating components that are rigid, overloaded with inputs, or filled with flags, you’ll learn how to design components that are truly flexible, composable, and scalable, the kind used in real-world component libraries and design systems.
You’ll start with element (attribute) directives, learning how to extend and enhance existing DOM elements. Then we dive into selector strategies and advanced selector patterns, giving you precise control over how your directives and components are applied.
Next, we move into content projection, where you’ll learn how to design components that accept external pieces and compose them into flexible layouts. From there, we cover styling and view encapsulation, understanding how Angular scopes styles and how to build components that can be themed and customized.
After that, we go deeper into templates with ng-template, TemplateRef, and ngTemplateOutlet, followed by Angular microsyntax, where you’ll understand how the * syntax works and how to design clean, intuitive directive APIs.
We then bring it all together with structural directives and view manipulation using ViewContainerRef, giving you full control over how views are created, updated, and managed at runtime. Finally, we cover dynamic components, completing the picture of fully flexible and programmable UI composition.
Throughout the course, everything is tied together into clear patterns you can apply immediately in your own projects.
By the end, you won’t just know Angular features, you’ll know how to use them together to build components like a pro.