[Angular-Scaled web] 1. Architecture and file structure

We build a project according to its features or based on simple MVC structure. Put all controller into one folder and factory into another folder is hard to maintain and testing.

For this project, we have two main features

  1. Category
  2. Bookmark

And one Category contains serveal bookmarks. 

For bookmarks, we can do 'edit', 'create' options.

We should also isolate one common model, in which we place something can be used for all other modules.

The stucture should be:

app

  • category
    • bookmarks
      • create
        • bookmarks-create.js
        • bookmarks-create.tmpl.html
      • edit
        • bookmarks-edit.js
        • bookmarks-edit.tmpl.html
      • bookmarks.js
      • bookmarks.tmpl.html
    • category.js
    • category.tmpl.html
  • common
    • models
      • category-model.js
      • bookmarks-model.js
  • app.complete.js
  • app.start.js
  • app.finish.js

assets  //where to put css and image files

  • css
  • images

data // where to store the json files

  • bookmarks.json
  • categories.json

vendor //where to store extension js files

  • angular-ui-router.min.js

app.complete.html

app.start.html

app.finish.html

原文地址:https://www.cnblogs.com/Answer1215/p/4071843.html