Angular 文件夾結構 (Angular Folder Structure)


問題描述

Angular 文件夾結構 (Angular Folder Structure)

我對 Angular 應用程序的正確結構感到困惑。我可以就我的應用程序的正確 Angular 結構徵求意見嗎?根據 Angular 文檔,正確的結構是什麼?我很困惑。謝謝。請查看我圖片上的 2 Angular 結構。我需要將服務和模型分開到不同的文件夾嗎?

結構 1結構2


參考解法

方法 1:

No specific folder structure is "correct". If your application is small and you just have a few components and a single module, I would keep it simple in a flat structure. If there are lot's of modules and components, maybe group components and services in the same folder as the module where they are declared.

In any case the folder structure is not what makes your Angular app work or not, but you should make it in a way that navigating your source files is as easy and readable as possible.

Also see this: https://angular.io/guide/styleguide#flat

(by JosephPeter Salomonsen)

參考文件

  1. Angular Folder Structure (CC BY‑SA 2.5/3.0/4.0)

#angular7 #Angular #angular6






相關問題

更改角度 7 中打印值的顏色 (Change the colour of printed value in angular 7)

在Angular7中更改路線的頁面重新加載問題 (Page reload issue on changing the route in Angular7)

如何使用訂閱來映射對象 (How to map object using subscribe in angular)

Angular 文件夾結構 (Angular Folder Structure)

在兄弟組件之間傳遞數據 (Passing Data between sibling components)

如何在 *ngFor 中循環選擇標籤並獲取所選值 (how to loop throught select tags inside *ngFor and get the selected value)

如何測試角度事件監聽器? (How to test angular event listeners?)

Angular 7/8 響應開發服務器上的健康檢查 (Angular 7/8 respond to health-checks on the dev server)

NgRx Store:如何在兩個功能模塊之間共享數據 (NgRx Store : How to share the data between two feature modules)

根據角度表單構建器/組中其他字段的值運行並設置一個字段的驗證錯誤 (Run and set the validation errors on one field based on the value of other field in angular form builder/group)

如何更改 Angular Material 中的標籤標籤? (How to change tab label in Angular Material?)

429 Too Many Requests - Angular 7 - 多個文件上傳 (429 Too Many Requests - Angular 7 - on multiple file upload)







留言討論