Code Organization
* Organize your controllers in a parent-children hierarchy like this:
Inspired by Jim Lavin: AngularJS Services, Section Responsibilities of Controllers, Packt Publishing 2014.
Common JavaScript Coding Patterns
- If you are not familiar with the pattern:
- Object-oriented JavaScript using prototyping:
- Introduction to Object-Oriented JavaScript (Mozilla Developer Network)
- Create Advanced Web Applications With Object-Oriented Techniques (Microsoft Developer Network)
- Classical Inheritance in JavaScript (Douglas Crockford)
- Prototype-based Programming (Wikipedia)
- Christian Heilmann's Revealing Module Pattern (Another read: JavaScript Design Patterns - The Revealing Module Pattern)
Example by Jim Lavin from the book AngularJS Services:
Five Ways of Service at a Glance
- constant: to define values that will not change over the course of your application
- value: to define values that will not change over the course of your application
- service: to define your services as a class and need to invoke the definition's constructor
- factory: to define your services as an object instance and no need to invoke the definition's constructor
- provider: to configure your service in a module's config method
- StackOverflow :: AngularJS: service vs provider vs factory?
- AngularJS.org Developer Guide :: Services
Data Management
- K. Scott Allen: Building Better Models for AngularJS
- Sandeep Panda: Creating a CRUD App in Minutes with Angular's $resource, and official API doc of $resource.
AngularJS Style Guide
- Todd Motto's Opinionated AngularJS Style Guide for Teams
- John Papa's Opinionated AngularJS Stle Guide for Teams
Productivity Tools
* Documenting your code:
- JSDoc
(to be updated)
No comments:
Post a Comment