-
Notifications
You must be signed in to change notification settings - Fork 11.9k
Closed
Labels
area: @schematics/angularfeatureIssue that requests a new featureIssue that requests a new featurefeature: 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 issue
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
vdumbrav, AgentEnder, mainawycliffe, nartc, mephistorine and 21 moretonivj5, MunMunMiao, junekpavel, erhardos and cyrilletuzi
Metadata
Metadata
Assignees
Labels
area: @schematics/angularfeatureIssue that requests a new featureIssue that requests a new featurefeature: 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 issue