angular-control-flow

Migrate legacy Angular template directives to @if/@for/@switch syntax.

6|1|Updated Feb 18, 2026
One-click install
npx skills add https://github.com/oguzhan18/angular-ecosystem-skills --skill angular-control-flow
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: angular-control-flow
Source: https://github.com/oguzhan18/angular-ecosystem-skills/tree/main/skills/angular-control-flow
Command: npx skills add https://github.com/oguzhan18/angular-ecosystem-skills --skill angular-control-flow

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Helps developers replace legacy structural directives and hand-rolled conditional rendering with the new Angular control flow syntax to simplify templates, improve readability, and enable better performance and lazy-loading patterns.

Core Features & Use Cases

  • Migration Guidance: Step-by-step recommendations to migrate *ngIf, *ngFor, and ngSwitch to @if, @for, and @switch while preserving semantics.
  • Performance & Best Practices: Guidance on using track with @for, empty-state handling, and using @defer with placeholders for lazy-loaded views.
  • Use Case: Port a large Angular 16 codebase to Angular 17+ templates, replacing legacy directives, adding track functions for lists, and adopting defer for heavy components.

Quick Start

Use the angular-control-flow skill to convert a component using *ngIf and *ngFor to @if and @for and produce a concise migration diff and performance notes.

Frequently Asked Questions about angular-control-flow

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I migrate Angular templates from *ngIf and *ngFor to the new control flow syntax?

To migrate Angular templates, replace legacy structural directives like *ngIf and *ngFor with the new @if and @for control flow syntax. This process preserves template semantics while modernizing conditionals and loops for Angular 17+ upgrades.

What is the new Angular control flow syntax and when should I use it?

The new Angular control flow syntax uses @if, @for, and @switch for template logic, replacing deprecated directives. Use it during Angular 17+ migrations to simplify templates, improve readability, and enable better performance and lazy-loading patterns.

Can I use @defer with placeholders for lazy-loaded views in Angular 17?

Yes, you can use @defer with placeholders for lazy-loaded views in Angular 17+. The control flow migration recommends adding defer placeholders and lazy-loading rules to optimize performance for heavy components during template refactoring.

Does migrating to Angular control flow syntax require adding track keys for list rendering?

Yes, migrating to Angular control flow syntax requires adding track keys for list rendering. When replacing *ngFor with @for, the migration process ensures track functions are added to maintain performance and proper collection updates.

What is the best way to handle empty states when replacing ngSwitch with @switch in Angular?

The best way to handle empty states when replacing ngSwitch with @switch is to use the built-in empty state handling provided by the new control flow syntax. This ensures semantic preservation while simplifying conditional rendering logic.

Are there limitations when refactoring large Angular 16 codebases to control flow syntax?

When refactoring large Angular 16 codebases to control flow syntax, limitations include ensuring all legacy directives are properly replaced and track keys are configured. The migration targets Angular 17+ templates and requires careful semantic preservation during upgrades.