AngularJS 1.x ~ Architecture - rohit120582sharma/Documentation GitHub Wiki

If you are looking for an opinionated style guide for syntax, conventions, and structuring Angular applications, then step right in. These styles are based on my development experience with AngularJS.

Purpose

  • Architecture is very important to increase the readability and maintainability of a project
  • There are a few marks to consider for designing the intelligent architecture:
    • How to break the code down into files and arrange these files in a sensible manner?
    • How an application's files and JavaScript modules will be organised?
    • How communicating data between AngularJS components?

Different paradigms for arranging AngularJS files

First, consider AngularJS file‐naming conventions. Using hyphen‐delimited file names simply adds an additional level of indirection between what a variable is named and the file it’s defined in. For instance, if FoodItemController has its own file, the file should be named food-item.controller.js

  • Small Projects
    • Small‐sized projects can be structured by having one file for controllers, one for services, and one for directives
  • Medium Projects
    • Medium‐sized projects can be structured by having a separate directory for controllers, directives, and services
  • Large Projects
    • Large projects benefit from grouping their AngularJS components by functionality
    • Each of the functionality groups can contain either a single file or a directory for its controllers, directives, and services. Each of these separate directories should be independent of each other
    • Components that are common between multiple functionality groups can reside in a shared directory

Reference