explaingit

toddmotto/angularjs-styleguide

5,921Audience · developerComplexity · 1/5Setup · easy

TLDR

A coding conventions guide for AngularJS 1.x teams that shows how to organize code using component-based patterns aligned with Angular 2, making future migration easier.

Mindmap

mindmap
  root((angularjs-styleguide))
    What it does
      Coding conventions
      Component patterns
      Migration guidance
    Tech stack
      AngularJS 1.x
      ES2015
      JavaScript
    Use cases
      Team consistency
      Angular 2 prep
      Dev onboarding
    Audience
      Dev teams
      AngularJS maintainers
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Establish a shared set of coding conventions for your team building AngularJS 1.x applications

USE CASE 2

Refactor an existing AngularJS codebase toward component-based patterns to prepare for an Angular 2 migration

USE CASE 3

Onboard new developers to a team that maintains AngularJS apps using a documented, agreed-upon style

Tech stack

JavaScriptAngularJSES2015

Getting it running

Difficulty · easy Time to first run · 5min
No license information is mentioned in the guide.

In plain English

This repository is a style guide for building web applications with AngularJS 1.x, the older version of the Angular JavaScript framework. AngularJS is a tool for building interactive web pages that update dynamically without reloading the browser. A style guide in this context is not about visual design: it is a set of conventions and recommendations for how to organize code so that a team can work on it consistently and scale it without it becoming hard to maintain. The guide was written to align AngularJS 1.5+ projects with the patterns that Angular 2 and later versions use, making it easier to migrate an existing codebase forward in the future. The central idea is component-based architecture, which means breaking the application into small, self-contained pieces (components) rather than organizing code by type (all controllers together, all services together). Each component owns its own logic, template, styles, and tests. The guide covers: how to structure modules and files on disk, how to write components, how data should flow between parent and child components (one direction only, using events to pass information back up), how to write directives and services, how to handle application routing, and how to use modern JavaScript (ES2015 classes and modules) with AngularJS. Each section includes explanation of the reasoning behind the recommendation and code examples showing what the pattern looks like in practice. The guide also touches on tooling and state management. It was written by Todd Motto, who also runs an Angular training platform. It is aimed at development teams who want a shared starting point rather than having each developer apply their own conventions.

Copy-paste prompts

Prompt 1
Using the AngularJS component-based style from the Todd Motto style guide, refactor this controller into a reusable component with one-way data bindings and event outputs
Prompt 2
Show me how to convert this AngularJS directive into a component following the angularjs-styleguide conventions for AngularJS 1.5+
Prompt 3
Rewrite this AngularJS service using ES2015 classes and modules as the toddmotto angularjs-styleguide recommends
Prompt 4
What folder and module structure does the angularjs-styleguide recommend for a feature that has a controller, service, and HTML template?
Open on GitHub → Explain another repo

← toddmotto on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.