Angular-cli component generator generate additiona

2019-07-10 00:46发布

问题:

Is there a way to override the default behavior of the

ng generate component 

command? In addition to the files that this command creates by default, I am wanting to have it generate a nested folder and several files within that folder inside the component that is created.

回答1:

Additional files are generated using additional commands. You can find a reference to it on https://github.com/angular/angular-cli

You can find all possible blueprints in the table below:

+-----------+---------------------------------+
| Scaffold  | Usage                           |
+-----------+---------------------------------+
| Component | ng g component my-new-component |
+-----------+---------------------------------+
| Directive | ng g directive my-new-directive |
+-----------+---------------------------------+
| Pipe      | ng g pipe my-new-pipe           |
+-----------+---------------------------------+
| Service   | ng g service my-new-service     |
+-----------+---------------------------------+
| Class     | ng g class my-new-class         |
+-----------+---------------------------------+
| Interface | ng g interface my-new-interface |
+-----------+---------------------------------+
| Enum      | ng g enum my-new-enum           |
+-----------+---------------------------------+
| Module    | ng g module my-module           |
+-----------+---------------------------------+