@title Structural Directives @intro Angular has a powerful template engine that lets us easily manipulate the DOM structure of our elements. @description This guide looks at how Angular manipulates the DOM with **structural directives** and how you can write your own structural directives to do the same thing. ### Table of contents - [What are structural directives?](#definition) - [*NgIf* case study](#ngIf) - [Group sibling elements with <ng-container>](#ng-container) - [The asterisk (\*) prefix](#asterisk) - [Inside *NgFor*](#ngfor) - [microsyntax](#microsyntax) - [template input variables](#template-input-variable) - [one structural directive per element](#one-per-element) - [Inside the *NgSwitch* directives](#ngSwitch) - [Prefer the (\*) prefix](#prefer-asterisk) - [The <template> element](#template) - [Write a structural directive](#unless) Try the . {@a definition} ## What are structural directives? Structural directives are responsible for HTML layout. They shape or reshape the DOM's _structure_, typically by adding, removing, or manipulating elements. As with other directives, you apply a structural directive to a _host element_. The directive then does whatever it's supposed to do with that host element and its descendents. Structural directives are easy to recognize. An asterisk (\*) precedes the directive attribute name as in this example. {@example 'structural-directives/ts/src/app/app.component.html' region='ngif'} No brackets. No parentheses. Just `*ngIf` set to a string. You'll learn in this guide that the [asterisk (\*) is a convenience notation](#asterisk) and the string is a [_microsyntax_](#microsyntax) rather than the usual [template expression](template-syntax.html#template-expressions). Angular "de-sugars" this notation into a marked-up `