Loading topic
@if block: its syntax, how Angular evaluates the condition, what happens to the DOM and to child components when the condition changes, and the mistakes that cause most bugs. It assumes you can write a standalone component with an inline template, use interpolation and even5 min readcount(), and use basic @if blocks. It builds on the @if chapter. You will learn how to chain alternatives, how Angular chooses a branch, and which mistakes cause wrong output.6 min read@if and @else syntax from the earlier chapters. Familiarity with signals and with RxJS observables helps, because most real uses of as involve one of them.6 min read@for block: its syntax, what it iterates over, and how it renders each item. It stays on the basic form and leaves the details of track, the implicit variables, and @empty to the chapters that follow.5 min read@for block from the previous chapter. Here we focus on one required part of it: the track expression.6 min read@for syntax and why it requires a track expression. Here you will learn the six implicit variables that @for provides, how to alias them, and the6 min read@for block draws nothing when its collection has no items, which leaves a blank area on the page. The @empty block lets you put a message, an illustration, or a call to action in that space. This chapter covers when @empty renders, what it can and cannot see, and how to combine it with load6 min read@switch block, which renders one of several templates based on the value of an expression. It assumes you know basic TypeScript, can write an Angular component with a template, and are comfortable with interpolation and event or property bindings. Familiarity with signals h6 min readnull, type guards), Angular components and templates, and signals. It also assumes your project compiles templates with strictTemplates turned on.6 min read@if, @else if, @else, @for with track, @empty, and @switch from the earlier chapters. It also assumes you can read a signal-based component. Here you will put the blocks together, and you will see which combinations work well and which cause trouble.5 min read@if, @for and @switch blocks, and that you have used signals or the async pipe. It covers the errors that show up most often in code reviews: wrong track choices, falsy aliases, signals that don't narrow, @switch equality, template syntax slips, and lef5 min read@if, @for, and @switch. Here you will map each old structural directive to its built-in block, use5 min read