Skip to content

Commit 8d8afa2

Browse files
committed
Merge pull request gocardless#4 from gocardless/blog-post-changes
Changes made while writing blog post
2 parents d79f6ce + 8ae1e51 commit 8d8afa2

File tree

1 file changed

+22
-12
lines changed

1 file changed

+22
-12
lines changed

README.md

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,32 @@
11
# Angular Style Guide
22

3-
## High Level Goals
3+
## Introduction
4+
5+
This style guide addresses four areas: High-level Goals; Directory and File Structure; Parts of Angular; and General Patterns and Anti-patterns.
6+
7+
High-level Goals are those that guide low-level decision making.
8+
9+
Directory and File Structure addresses the way we organise our code and why.
10+
11+
Parts of Angular addresses the core parts of AngularJS — routes, directives, controllers, modules, and templates.
12+
13+
General Patterns and Anti-patterns addresses those that do not pertain to a specific part, but instead to the application at large.
14+
15+
## Table of Contents
16+
1. [High-level Goals](#high-level-goals)
17+
2. [Directory and File Structure](#directory-and-file-structure)
18+
3. [Parts of Angular](#parts-of-angular)
19+
4. [General Patterns and Anti-patterns](#general-patterns-and-anti-patterns)
20+
21+
## High-level Goals
422

523
1. Prioritise readability.
624
2. Be explicit, not implicit.
725
3. Favour composability over inheritance.
826
4. Think forward – ES6 and Web Components (Angular 2.0).
927
5. Know [when to deviate](http://legacy.python.org/dev/peps/pep-0008/#a-foolish-consistency-is-the-hobgoblin-of-little-minds) from the style guide.
1028

11-
---
12-
13-
## Directories & Files
29+
## Directory and File Structure
1430

1531
### Folder structure
1632

@@ -74,13 +90,12 @@ Configures Providers. For example, `$locationProvider.html5Mode(true);`.
7490

7591
### Routes
7692

77-
A view that points to a URL. Like components, each route contains all the HTML, CSS, JavaScript, and other dependencies needed to render itself.
93+
A view, made up of components and unique pieces of UI, that points to a URL. Like components, each route contains all the HTML, CSS, JavaScript, and other dependencies needed to render itself.
7894

7995
### Services
8096

8197
Services contain Business logic. For example, `$http` abstractions.
8298

83-
---
8499

85100
## Parts of Angular
86101

@@ -160,7 +175,6 @@ function nextPage() {
160175
}
161176
```
162177

163-
---
164178

165179
### Directives
166180

@@ -334,7 +348,6 @@ angular.module('AdminExpandComponentModule', [])
334348
- Don't rely on jQuery selectors. Use directives to target elements instead.
335349
- Don't use jQuery to generate templates or DOM. Use directive templates instead.
336350

337-
---
338351

339352
### Controllers
340353

@@ -628,7 +641,6 @@ angular.module('AlertListComponentModule', [])
628641

629642
- Don’t manipulate DOM in your controllers, this will make them harder to test. Use directives instead.
630643

631-
---
632644

633645
### Modules
634646

@@ -697,7 +709,6 @@ import {AuthInterceptorModule} from '../services/auth-interceptor/auth-intercept
697709
import {OrganisationIdInterceptorModule} from '../services/organisation-id-interceptor/organisation-id-interceptor';
698710
```
699711

700-
---
701712

702713
### Templates
703714

@@ -718,7 +729,6 @@ _Why_: Avoids unnecessary expensive `$watch`ers.
718729
- Don’t use `ngInit` – use controllers instead.
719730
- Don’t use `<div ng-controller="Controller">` syntax. Use directives instead.
720731

721-
---
722732

723733
## General Patterns and Anti-Patterns
724734

@@ -795,7 +805,7 @@ angular.element(document).ready(function() {
795805
});
796806
```
797807

798-
### Anti-Patterns
808+
### Anti-patterns
799809

800810
#### Don’t use the `$` name space in property names (e.g. `$scope.$isActive = true`).
801811

0 commit comments

Comments
 (0)