diff --git a/packages/core/schematics/ng-generate/control-flow-migration/util.ts b/packages/core/schematics/ng-generate/control-flow-migration/util.ts index fd0d362d865de..7eb271756c8af 100644 --- a/packages/core/schematics/ng-generate/control-flow-migration/util.ts +++ b/packages/core/schematics/ng-generate/control-flow-migration/util.ts @@ -315,7 +315,7 @@ function buildIfThenElseBlock( } function migrateNgFor(etm: ElementToMigrate, tmpl: string, offset: number): Result { - const aliasWithEqualRegexp = /=\s+(count|index|first|last|even|odd)/gm; + const aliasWithEqualRegexp = /=\s*(count|index|first|last|even|odd)/gm; const aliasWithAsRegexp = /(count|index|first|last|even|odd)\s+as/gm; const aliases = []; const lbString = etm.hasLineBreaks ? lb : ''; diff --git a/packages/core/schematics/test/control_flow_migration_spec.ts b/packages/core/schematics/test/control_flow_migration_spec.ts index 93886eb2bab76..7c89d6343bb70 100644 --- a/packages/core/schematics/test/control_flow_migration_spec.ts +++ b/packages/core/schematics/test/control_flow_migration_spec.ts @@ -869,7 +869,6 @@ describe('control flow migration', () => { 'template: `