liveBook · Manning

Structural directive

A structural directive is an Angular directive that changes a template's structure by creating, removing, or transforming embedded views.

How 2 Manning books explain it

Pro Angular 16

A structural directive is an Angular directive that changes the rendered document structure by creating, removing, or repeating template content.

How it is used
Uses structural directives to add conditional content or repeat template content for data-source values.
How deep it goes
Works through template syntax, custom directive construction, module registration, and change handling, including the cost of rebuilding views.
Examples
Uses a checkbox-controlled product table, generated product rows, and page-navigation buttons.
What you can do after
Build it from scratch using @Directive, TemplateRef, ViewContainerRef, an input, and a module declaration.

Read how Pro Angular 16 explains structural directive →

Modern Angular

A structural directive is an Angular directive that changes a template's structure by creating, removing, or transforming embedded views.

How it is used
Simplifies conditional and dynamically composed Angular templates, especially repeated loading overlays and complex UI branches.
How deep it goes
Explains embedded-view creation, component projection, input updates, and lifecycle-aware changes, while deferring broader directive fundamentals.
Examples
Uses nested loading overlays, a custom loading directive, *ngIf and *ngFor, and @if conditional notification and project-card templates.
What you can do after
Build it from scratch as a standalone directive that creates embedded views, renders dynamic components, projects content, and updates inputs.

Read how Modern Angular explains structural directive →

What to know first

Related concepts

Questions about structural directive

What is structural directive?

A structural directive is an Angular directive that changes a template's structure by creating, removing, or transforming embedded views.

Which Manning books explain structural directive?

Pro Angular 16 and Modern Angular.

What should I know before learning structural directive?

Manning books that teach structural directive usually introduce directive first.

What is the difference between structural directive and attribute directive?

A structural directive is an Angular directive that changes a template's structure by creating, removing, or transforming embedded views. An attribute directive is an Angular directive that changes the behavior or presentation of an existing HTML element without changing the document structure.

What kinds of structural directive are there?

Kinds of structural directive include custom directive and ngFor binding.

What is structural directive a kind of?

Structural directive is a kind of directive. A directive is a framework-specific instruction attached to markup that controls processing, rendering, or the behavior of an element or template.

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.