Which type of folder structure should be used with Angular 2?

后端 未结 9 1672
慢半拍i
慢半拍i 2021-01-29 18:45

I am an Angular 1 developer that is starting to learn about Angular 2. There are a lot of different types of folder structure methods depending on the training material. I am

9条回答
  •  生来不讨喜
    2021-01-29 19:26

    Maybe something like this structure:

    |-- app
         |-- modules
           |-- home
               |-- [+] components
               |-- pages
                  |-- home
                  |-- home.component.ts|html|scss|spec
               |-- home-routing.module.ts
               |-- home.module.ts
         |-- core
           |-- authentication
               |-- authentication.service.ts|spec.ts
           |-- footer
               |-- footer.component.ts|html|scss|spec.ts
           |-- guards
               |-- auth.guard.ts
               |-- no-auth-guard.ts
               |-- admin-guard.ts 
           |-- http
               |-- user
                   |-- user.service.ts|spec.ts
               |-- api.service.ts|spec.ts
           |-- interceptors
               |-- api-prefix.interceptor.ts
               |-- error-handler.interceptor.ts
               |-- http.token.interceptor.ts
           |-- mocks
               |-- user.mock.ts
           |-- services
               |-- srv1.service.ts|spec.ts
               |-- srv2.service.ts|spec.ts
           |-- header
               |-- header.component.ts|html|scss|spec.ts
           |-- core.module.ts
           |-- ensureModuleLoadedOnceGuard.ts
           |-- logger.service.ts
         |-- shared
              |-- components
                  |-- loader
                      |-- loader.component.ts|html|scss|spec.ts
              |-- buttons
                  |-- favorite-button
                      |-- favorite-button.component.ts|html|scss|spec.ts
                  |-- collapse-button
                      |-- collapse-button.component.ts|html|scss|spec.ts
              |-- directives
                  |-- auth.directive.ts|spec.ts
              |-- pipes
                  |-- capitalize.pipe.ts
                  |-- safe.pipe.ts
         |-- configs
             |-- app-settings.config.ts
             |-- dt-norwegian.config.ts
         |-- scss
              |-- [+] partials
              |-- _base.scss
              |-- styles.scss
         |-- assets
    

提交回复
热议问题