[Angular-Scaled web] 2. Architecture sub-modules

Common models will be a sub models for category and bookmarks. Because they are used everywhere.

For bookmarks edit and create, all they need is a common sub module.

bookmarks.js needs create and edit modules and two common sub modules.

category.js needs common categories sub module.

Then in start.js, we include two main features: categories and bookmarks modules.

app

  • category
    • bookmarks
      • create
        • bookmarks-create.js
angular.module('categories.bookmarks.create', [
  'eggly.models.bookmarks'
])
        • bookmarks-create.tmpl.html
      • edit
        • bookmarks-edit.js
angular.module('categories.bookmarks.edit', [
  'eggly.models.bookmarks'
])
        • bookmarks-edit.tmpl.html
      • bookmarks.js
angular.module('categories.bookmarks', [
  'categories.bookmarks.edit',  //bookmarks for edit
  'categories.bookmarks.create',  //bookmarks for create
  'eggly.models.categories',   //common model for categories
  'eggly.models.bookmarks'  //common model for bookmarks
]);
      • bookmarks.tmpl.html
    • category.js
angular.module('categories', [
  'eggly.models.categories' //add common models for categories
])
    • category.tmpl.html
  • common
    • models
      • category-model.js
angular.module('eggly.models.categories', []);
      • bookmarks-model.js
angular.module('eggly.models.categories', []);
  • app.start.js
angular.module('Eggly', [
    'categories',  // all models included by categories will also be transfered to main model
    'categories.bookmarks'
])