This extension is designed to enhance your productivity by automating the creation of boilerplate code, allowing you to focus on building features rather than repetitive tasks. Whether you're a seasoned Angular developer or just starting out, this tool will help you maintain a clean and efficient codebase.
Are you tired of manually creating files for your Angular projects in Visual Studio Code? Angular File Generator eliminates repetitive boilerplate by generating classes, components, directives, services, and more with a handful of commands and snippets. With support for Angular 20's signal-based APIs and conventions, you'll spend less time setting up and more time building features.
This release updates Angular File Generator to support Angular 20 by including signal-based snippets (signal
, computed
, effect
, toSignal
) and removing redundant file suffixes (.component.ts
, .service.ts
) to streamline project structure and embrace Angular 20 conventions.
Title | Purpose |
---|---|
Angular: Generate Class | Creates a new, generic class definition |
Angular: Generate Component | Creates a new, generic component definition |
Angular: Generate Directive | Creates a new, generic directive definition |
Angular: Generate Enum | Generates a new, generic enum definition |
Angular: Generate Guard | Generates a new, generic route guard definition |
Angular: Generate Interceptor | Creates a new, generic interceptor definition |
Angular: Generate Interface | Creates a new, generic interface definition |
Angular: Generate Module | Creates a new, generic NgModule definition |
Angular: Generate Pipe | Creates a new, generic pipe definition |
Angular: Generate Resolver | Generates a new, generic resolver definition |
Angular: Generate Service | Creates a new, generic service definition |
Angular: Generate Test | Creates a new, generic test definition |
Angular: Generate Template | Creates a new file with a template definition |
Title | Purpose |
---|---|
Angular: New Application | Creates a new Angular application |
Angular: Start Server | Builds and serves your application, rebuilding on file changes |
Angular: Version | Outputs Angular CLI version |
Angular: Run Tests | Runs unit tests in a project |
Angular: Run E2E | Builds and serves an Angular application, then runs end-to-end tests |
Angular: Disable Analytics | Disables analytics gathering and reporting for the user |
Angular: Enable Analytics | Enables analytics gathering and reporting for the user |
Angular: Info Analytics | Prints analytics gathering and reporting configuration in the console |
Angular: Prompt Analytics | Prompts the user to set analytics gathering status interactively |
Angular: Clean Cache | Deletes persistent disk cache from disk |
Angular: Disable Cache | Disables persistent disk cache for all projects in the workspace |
Angular: Enable Cache | Enables disk cache for all projects in the workspace |
Angular: Info Cache | Prints persistent disk cache configuration and statistics in the console |
Angular: Generate Component with CLI | Creates a new, generic component definition using Angular CLI |
Angular: Generate Guard with CLI | Creates a new, generic guard definition using Angular CLI |
Angular: Generate Pipe with CLI | Creates a new, generic pipe definition using Angular CLI |
Angular: Generate Service with CLI | Creates a new, generic service definition using Angular CLI |
Angular: Generate Environments | Generates and configures environment files for a project |
Angular: Generate Library | Creates a new, generic library project in the current workspace |
Prefix | Purpose |
---|---|
ng_class_module |
export class Module {} |
ng_class_routing_module |
export class RoutingModule {} |
ng_const_routes |
export const routes: Routes = [] |
ng_class_component |
export class Component {} |
ng_class_standalone_component |
export class Component {} |
ng_class_service |
export class Service {} |
ng_const_environment |
export const environment = {} |
ng_oninit |
ngOnInit {} |
ng_on_destroy |
ngOnDestroy {} |
ng_unsubscribe |
private unsubscribe: Subscription[] = [] |
ng_subscribe |
this.unsubscribe.push(this.subscr); |
ng_signal |
const mySignal = signal(...) |
ng_computed |
const myComputed = computed(() => ...) |
ng_effect |
effect(() => ...) |
ng_linked_signal |
const myLinkedSignal = linkedSignal(...) |
ng_to_signal |
const signalFromObservable = toSignal(...) |
ng_resource |
const myResource = resource(() => ...) |
ng_class_standalone_component_reactivity |
export class Component {} |
ng_on_destroy_reactivity |
implements OnDestroy {} |
ng_if |
@if (condition) {} |
ng_if_else |
@if (condition) {} @else {} |
ng_if_else_if |
@if (condition) {} @else if (condition) {} |
ng_else_if |
@else if (condition) {} |
ng_else |
@else {} |
ng_for |
@for (condition) {} |
ng_empty |
@empty {} |
ng_switch |
@switch (condition) {} |
ng_case |
@case (condition) {} |
ng_default |
@default {} |
ng_defer |
@defer (condition) {} |
ng_placeholder |
@placeholder {} |
ng_loading |
@loading {} |
ng_router_outlet |
<router-outlet></router-outlet> |
ng_router_link |
<a routerLink=""></a> |
To customize the extension's behavior, create or update a .vscode/settings.json
file at your project's root. If you already have one, simply merge these properties.
Your project is now set up to automatically format code upon saving.
Setting | Description | Default |
---|---|---|
angular.enable |
Enable or disable the extension | true |
angular.components.standalone |
Generate standalone components by default | true |
angular.components.style |
Default style file extension for new components (css , scss , etc.) |
css |
angular.files.include |
File extensions to include in the sidebar | ["ts"] |
angular.files.exclude |
Glob patterns to exclude from the sidebar | ["**/node_modules/**", ...] |
angular.files.watch |
Folders (by type) to watch in the sidebar (modules , components , services ) |
["modules","components","services"] |
angular.files.showPath |
Show file paths in the sidebar | true |
angular.terminal.cwd |
Absolute path for terminal current working directory | |
angular.submenu.customCommands |
List of custom CLI commands to show under a submenu | [] |
angular.submenu.templates |
List of custom file templates for quick generation | [] |
angular.submenu.activateItem |
Items (by category) to activate in the submenu | { see example } |
angular.fileGenerator.skipFolderConfirmation |
Skip folder confirmation dialog when generating files | false |
angular.fileGenerator.omitSuffix |
Omit file suffixes (e.g., .component.ts , .service.ts ) |
false |
angular.fileGenerator.typeSeparator |
Separator between name and type in filenames (e.g., name.type.ts ) |
"." |
-
Custom Commands (
angular.submenu.customCommands
): Define aliases for frequently used Angular CLI commands, including custom flags."angular.submenu.customCommands": [ { "name": "Generate Feature Component", "command": "ng g c", "args": "--style scss --standalone true" } ]
-
Custom Templates (
angular.submenu.templates
): Provide code templates for generating files with placeholders. Use{{ComponentName}}
and{{EntityName}}
(or custom placeholders) to insert names automatically.
Angular 19 and earlier generated filenames with explicit suffixes:
-
Before (Angular ≤19)
ng g c user
→user.component.ts
(exportsclass UserComponent
)ng g s user
→user.service.ts
(exportsclass UserService
)
Angular 20 conventions encourage simpler filenames:
-
Now (Angular 20)
ng g c user
→user.ts
(exportsclass User
)ng g s user
→user.ts
(exportsclass User
)
This extension now follows this convention by default, generating files without the .component.ts
or .service.ts
suffixes. For enabling this behavior, you can set the angular.fileGenerator.omitSuffix
option to true
in your project's .vscode/settings.json
file.
{
"angular.fileGenerator.omitSuffix": true
}
This aligns with Angular 20's approach to file naming and simplifies your project structure.
Tip: To restore the old
.component.ts
/.service.ts
suffixes, add the following to your project'sangular.json
:{ "projects": { "your-app": { "schematics": { "@schematics/angular:component": { "type": "component" }, "@schematics/angular:directive": { "type": "directive" }, "@schematics/angular:service": { "type": "service" }, "@schematics/angular:guard": { "typeSeparator": "." }, "@schematics/angular:interceptor": { "typeSeparator": "." }, "@schematics/angular:module": { "typeSeparator": "." }, "@schematics/angular:pipe": { "typeSeparator": "." }, "@schematics/angular:resolver": { "typeSeparator": "." } } } } }
Angular File Generator is open-source and welcomes community contributions:
-
Fork the GitHub repository.
-
Create a new branch:
git checkout -b feature/your-feature
-
Make your changes, commit them, and push to your fork.
-
Submit a Pull Request against the
main
branch.
Before contributing, please read the Contribution Guidelines for coding standards, testing, and commit message conventions.
We are committed to providing a friendly, safe, and welcoming environment for all, regardless of gender, sexual orientation, disability, ethnicity, religion, or similar personal characteristic. Please review our Code of Conduct before participating in our community.
For a complete list of changes, see the CHANGELOG.md
- Manuel Gil - Owner - ManuelGil
See also the list of contributors who participated in this project.
If you enjoy using this extension, consider following me for updates on this and future projects:
- Angular File Generator
- NestJS File Generator
- T3 Stack / NextJS / ReactJS File Generator
- JSON Flow
- Auto Barrel
- CodeIgniter 4 Spark
Angular File Generator is licensed under the MIT License - see the MIT License for details.