-
Notifications
You must be signed in to change notification settings - Fork 27.1k
ng g @angular/core:standalone should prefer NgFor instead of NgForOf #49006
Copy link
Copy link
Closed
Labels
area: migrationsIssues related to `ng update`/`ng generate` migrationsIssues related to `ng update`/`ng generate` migrationscross-cutting: standaloneIssues related to the NgModule-less worldIssues related to the NgModule-less world
Milestone
Description
Which @angular/* package(s) are relevant/related to the feature request?
core
Description
ng new standalone-migration --defaults
cd standalone-migration
ng update @angular/core@next @angular/cli@next --force
echo "<div *ngFor="let i of [1, 2]">Hello world</div>" > src/app/app.component.html
ng g @angular/core:standalone --defaults --mode standalone-bootstrap
app.component.ts gets migrated to:
import { Component } from '@angular/core';
import { NgForOf } from '@angular/common';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css'],
standalone: true,
imports: [NgForOf]
})
export class AppComponent {
title = 'standalone-migration';
}Proposed solution
The recently introduced alias NgFor should be used instead of NgForOf
Alternatives considered
It can be replaced manually
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area: migrationsIssues related to `ng update`/`ng generate` migrationsIssues related to `ng update`/`ng generate` migrationscross-cutting: standaloneIssues related to the NgModule-less worldIssues related to the NgModule-less world