-
Notifications
You must be signed in to change notification settings - Fork 11.9k
Closed
Labels
area: @schematics/angularfeatureLabel used to distinguish feature request from other issuesLabel used to distinguish feature request from other issuesfeature: under considerationFeature request for which voting has completed and the request is now under considerationFeature request for which voting has completed and the request is now under considerationgood first issueLabel noting a good first issue to be worked on by a community memberLabel noting a good first issue to be worked on by a community member
Description
Command
generate
Description
When I want to generate a component to use as a lazy loaded component with loadComponent I can use the schematic
ng generate component about --standalone```ts
import { Component } from '@angular/core';
import { CommonModule } from '@angular/common';
@Component({
selector: 'app-about',
standalone: true,
imports: [CommonModule],
templateUrl: './about.component.html',
styleUrls: ['./about.component.css']
})
export class AboutComponent {
}Then when I go to use the component in the route config, I immediately get an error because its not a default export
[
{ path: 'about', loadComponent: () => import('./about/about.component') }
]Describe the solution you'd like
Add an option to generate a component with the class as a default export
ng generate component about --standalone (--export-default or --default-export)import { Component } from '@angular/core';
import { CommonModule } from '@angular/common';
@Component({
selector: 'app-about',
standalone: true,
imports: [CommonModule],
templateUrl: './about.component.html',
styleUrls: ['./about.component.css']
})
export default class AboutComponent {
}Describe alternatives you've considered
Manually update the component after generation
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area: @schematics/angularfeatureLabel used to distinguish feature request from other issuesLabel used to distinguish feature request from other issuesfeature: under considerationFeature request for which voting has completed and the request is now under considerationFeature request for which voting has completed and the request is now under considerationgood first issueLabel noting a good first issue to be worked on by a community memberLabel noting a good first issue to be worked on by a community member