企业项目组织
我组织 Angular 项目的方式是:
/app
/img # application-level images
/css # application-level css styles
/js # application-level javascripts
/modules # application modules
/gallery # independent module with its own infrastructure
/controllers # gallery module's controllers
/css # gallery module's css styles
/directives # gallery module's directives
/img # gallery module's images
/filters # gallery module's filters
/services # gallery module's services
/views # gallery module's views (htmls)
/ ... # other gallery module component folders
galleryMod.js # the module itself
/user # independent module with its own infrastructure
/controllers # user module's controllers
/ ... # other user module component folders
userMod.js # the module itself
/ ... # other modules
/ ... # other application-level folders
index.html
替代企业项目组织(简化)
/app
/img # application-level images
/css # application-level css styles
/js # application-level javascripts
/modules # application modules
/gallery # independent module with its own infrastructure
/js # gallery module's javascripts (includes
# services.js, directives.js, filters.js, ...)
/css # gallery module's css styles
/img # gallery module's images
/views # gallery module's views (htmls, "partials")
/ ... # other gallery module component folders
galleryMod.js # the module itself
/user # independent module with its own infrastructure
/controllers # user module's controllers
/ ... # other user module component folders
userMod.js # the module itself
/ ... # other modules
/ ... # other application-level folders
index.html
中间项目组织(无模块)
/app
/img # application's images
/css # application's css styles
/controllers # application's controllers
/directives # application's directives
/filters # application's filters
/services # application's services
/views # application's views (htmls)
/ ... # other component folders
index.html
简单的项目组织(就像种子一样)
/app
/img # application's images
/css # application's css styles
/js # application's javascripts (includes
# services.js, directives.js, filters.js, ...)
/views # application's views (htmls), e.g. partials
/ ... # other component folders
index.html
使用您的项目需要组织的方式,不要选择会使您的项目不必要地复杂化的方式。