Introduce "add-type-to-class-name" option to Ng Generate Application and Ng New

Open
#31,582 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
angular, typescript
Domain
cli, tooling

Research direction

Start with the ng new and ng generate application command entry points and the angular.json schematics configuration described in the issue. Trace how application options are applied, then verify that the requested option can set addTypeToClassName for future component, service, and directive generation.

Written by the indexing model from the issue text.

Description

area: @schematics/angular feature feature: insufficient votes
Command

new, generate

Description

To enhance Angular CLI so that developer can control whether the app component generated during ng new or ng generate application will have the Type appended to its class name (i.e AppComponent) or not.

In addition, to allow developer to set a default angular.json's schematics "addTypeToClassName" to true via command line, so that future creation of component (include service and directive) via CLI will by default include the type inside the classname.

Describe the solution you'd like
  1. introduce add-type-to-class-name option to Ng Generate Application and Ng New, OR
  2. rename the "file-name-style-guide" option to "style-guide", with 4 possible values
    addTypeToClassNameOnly, addTypeToFileNameOnly, addTypeToFileAndClassName, 2025

Doing so, will set the addTypeToClassName to true inside the angular.json for component, service and directive

Describe alternatives you've considered

Currently, developer has to manually change the class name for the App Component to include the Type

Dominant language
TypeScript
Stars
27k
Forks
11.8k
Avg merge
16h 35m
Merged PRs (30d)
176

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from angular/angular-cli

All issues in angular/angular-cli

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.