Valentine Awe

Angular Magical directives

What if you could stop repeating yourself in Angular? Master four magical directives to build truly reusable components.

Angular Magical directives
#1about 1 minute

Overview of Angular's core structural directives

An introduction to the four key directives for building clean and reusable components: ng-template, ng-container, ng-content, and ng-template-outlet.

#2about 3 minutes

How to use ng-template for conditional rendering

Learn how ng-template represents an Angular template without rendering to the DOM until explicitly called, which is useful for complex `ngIf/else` logic.

#3about 3 minutes

Using ng-container to avoid extra DOM elements

Use ng-container as a grouping element that doesn't create an extra node in the DOM, helping to write cleaner HTML and improve performance.

#4about 5 minutes

Creating reusable components with ng-content

Implement content projection using ng-content to pass content into a component, and use the `select` attribute for multi-slot projection.

#5about 8 minutes

Building highly configurable components with ng-template-outlet

Leverage ng-template-outlet to create highly dynamic components by providing default templates and passing contextual data into a template.

#6about 7 minutes

Q&A on styling, dynamic components, and performance

Audience questions are answered regarding styling projected content without `::ng-deep`, handling many template variations, and performance considerations.

Related jobs
Jobs that call for the skills explored in this talk.

Angular Developer

Picnic Technologies B.V.
Amsterdam, Netherlands

Intermediate
Senior

Featured Partners

Related Articles

View all articles
DC
Daniel Cranney
The HTML Elements That You’re Probably Over-Engineering
As frameworks have become more and more commonplace in the world of web development, so too has the over-engineering of features made possible by our humble old friend, HTML. The mental models that come with using state management in React, Vue and o...
The HTML Elements That You’re Probably Over-Engineering
DC
Daniel Cranney
Exploring TypeScript: Benefits for Large-Scale JavaScript Projects
JavaScript is the backbone of web development, powering everything from small websites to large-scale enterprise applications. However, as projects grow in complexity, maintaining JavaScript code can become increasingly difficult. This is where TypeS...
Exploring TypeScript: Benefits for Large-Scale JavaScript Projects
DC
Daniel Cranney
What Developers Really Need to Create Great Code Demos
Every developer on earth has, at some point, had another developer to thank for a breakthrough, a success, an aha moment they wouldn’t have had without coming across that blog post, that open-source contribution, that reply on socials or that humble ...
What Developers Really Need to Create Great Code Demos

From learning to earning

Jobs that call for the skills explored in this talk.

Angular Developer

Angular Developer

mpro5
Royal Tunbridge Wells, United Kingdom

46K
CSS
GIT
Azure
Scrum
+5