angular/packages/core/schematics/migrations/control-flow-migration
Joey Perrott cbc258eec8 build: remove ts_project_interop infrastructure (#62908)
Remove the interop macros and final usages

PR Close #62908
2025-07-31 09:12:58 +00:00
..
BUILD.bazel build: remove ts_project_interop infrastructure (#62908) 2025-07-31 09:12:58 +00:00
cases.ts refactor(core): run the control flow migration during ng update (#60492) 2025-03-28 15:46:41 +00:00
fors.ts refactor(core): run the control flow migration during ng update (#60492) 2025-03-28 15:46:41 +00:00
identifier-lookup.ts refactor(core): run the control flow migration during ng update (#60492) 2025-03-28 15:46:41 +00:00
ifs.ts refactor(core): run the control flow migration during ng update (#60492) 2025-03-28 15:46:41 +00:00
index.ts refactor(migrations): keep the control flow migration as ng generate. (#61773) 2025-06-03 07:12:59 -04:00
migration.ts refactor(core): run the control flow migration during ng update (#60492) 2025-03-28 15:46:41 +00:00
README.md refactor(core): run the control flow migration during ng update (#60492) 2025-03-28 15:46:41 +00:00
schema.json refactor(core): run the control flow migration during ng update (#60492) 2025-03-28 15:46:41 +00:00
switches.ts refactor(core): run the control flow migration during ng update (#60492) 2025-03-28 15:46:41 +00:00
types.ts refactor(core): run the control flow migration during ng update (#60492) 2025-03-28 15:46:41 +00:00
util.ts refactor(core): run the control flow migration during ng update (#60492) 2025-03-28 15:46:41 +00:00

Control Flow Syntax migration

Angular v17 introduces a new control flow syntax. This migration replaces the existing usages of *ngIf, *ngFor, and *ngSwitch to their equivalent block syntax. Existing ng-templates are preserved in case they are used elsewhere in the template. It has the following option:

  • path - Relative path within the project that the migration should apply to. Can be used to migrate specific sub-directories individually. Defaults to the project root.

Before

import {Component} from '@angular/core';

@Component({
  template: `<div><span *ngIf="show">Content here</span></div>`
})
export class MyComp {
  show = false;
}

After

import {Component} from '@angular/core';

@Component({
  template: `<div>@if (show) {<span>Content here</span>}</div>`
})
export class MyComp {
  show = false
}