問題描述
Angular 文件夾結構 (Angular Folder Structure)
我對 Angular 應用程序的正確結構感到困惑。我可以就我的應用程序的正確 Angular 結構徵求意見嗎?根據 Angular 文檔,正確的結構是什麼?我很困惑。謝謝。請查看我圖片上的 2 Angular 結構。我需要將服務和模型分開到不同的文件夾嗎?
參考解法
方法 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 Joseph、Peter Salomonsen)