Creating Other Things
The CLI can scaffold other Angular entities such as services, pipes and directives using the generate command.
ng generate [entity] [entity-name]
This creates the entity at src/app/[entity-name].[entity].ts
along with a spec file, or at the current path if the command is executed in a child folder of the project. The CLI provides blueprints for the following entities out of the box:
Item | Command | Files generated |
Component: |
| component, HTML, CSS, test spec files |
Directive: |
| component, test spec files |
Pipe: |
| component, test spec files |
Service: |
| component, test spec files |
Class: |
| component, test spec files |
Route: |
| component, HTML, CSS, test spec files (in new folder) |
Last updated