Skip to content

Angular style guide with multiple versions for different scenarios

Notifications You must be signed in to change notification settings

alvaro450/angular-styleguide

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 

Repository files navigation

Todos

  • create a separate todo markdown file
  • Move each categorical section of the styles to its own folder+readme.md. Then link to it from the top level readme.md.
  • add a contributing markdown file with a link from readme.md (Anyone is allowed to contribute by starting issues and sending PRs)

angular-styleguide

This guide is heavily biased towards large enterprises with many software projects with team members highly cross cut among projects. For this reason, we will set the stage with a fictitious company and its products. It is an opinionated guide but will often provide more than one way to follow for a specific style.

This guide is heavily influenced by John Papa's Angular Style Guide and can be thought of as extending it. Where something is not specifically mentioned here, you can fall back to the John Papa Style Guide style(s) mentioned there.

Come up with a short acronym for the name of your company
Company: Rusty Parts Inc.
Acronym: RP

Come up with a short and company unique acronym for the name of your product
Software Product: Part Scanner
Acronym: PS

Modules

Naming

With a long company name and products names that can be just as lengthy, it makes more sense to come up with some acronyms to use in your company for naming angular modules. Prefix all module names like companynameacronym.productnameacronym. Then, add one dot-delimited segment for each folder.

A project with a folder structure like part-scanner/app/scanner containing an angular module would be defined like so

angular.module('rp.ps.scanner');

Services*, factories and providers*

Naming

coming

Functions and class methods

Naming

Functions and class method names should be descriptive and specific following the lower camel case convention.

performAlgorithmA() {
}

Async Promise returning functions

If a function returns a promise, it should be suffixed with Async. This is a good convention that portrays intent especially when used with the upcoming version of ECMAScript that includes the async and await keywords.

createPartAsync(part) {
  return $http.post('/parts', part);
}

About

Angular style guide with multiple versions for different scenarios

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published