Angular-cli: Folder structure for modules, components, directives, services, etc

Created on 4 Oct 2017  路  4Comments  路  Source: angular/angular-cli

The CLI should also suggest folder structure for modules, components, directives, services, etc...
Everything generated by AngularCLI is placed in src/app directory unless you specify the path.
It should be great to have a kind of standard for these paths too.

Here is an example of folder structure:
https://medium.com/@motcowley/angular-folder-structure-d1809be95542

- app.module.ts
- app.component.ts
- modules
    - module1
        - components
        - pages
            module1.service.ts
            module1.module.ts
            module1.routes.ts
    - module2
        - components
        - pages
            module2.service.ts
            module2.module.ts
            module2.routes.ts
- shared
    - components
    - mocks
    - models
    - ...

Most helpful comment

The base path for the generate command is the current working directory. The intention is that the user would change into the directory of the module/component/etc. as they are working on that particular area of the application.

The CLI also strives to follow the official Angular Style Guide.

All 4 comments

The base path for the generate command is the current working directory. The intention is that the user would change into the directory of the module/component/etc. as they are working on that particular area of the application.

The CLI also strives to follow the official Angular Style Guide.

I concur with @clydin the style guide he linked to is the suggested folder structure to follow. That being said the CLI is a tool that you control... and therefore you are in charge of the directory structure that makes the most sense for you and your application(s).

Angular CLI should _suggest_ an implementation of this:
angular.io/guide/styleguide#application-structure-and-ngmodules

In order to start an Angular project with a standard/official Angular Directory Structure.

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

_This action has been performed automatically by a bot._

Was this page helpful?
0 / 5 - 0 ratings