I just published the first draft of my opinionated style guide for syntax, conventions, and structuring AngularJS applications. You'll find many of these and more explained in deeper detail in my Pluralsight course AngularJS: Clean Code (coming in August 2014). The styles contained here are based on on my experience with AngularJS, presentations, Pluralsight training courses and working in teams. I will keep this guide updated on github.
Usage and Purpose
I get asked a lot for style guides, how to get started once you learn the AngularJS basics, and what I recommend. This guide helps point in that direction using my guidelines. The purpose of this style guide is to provide guidance on building AngularJS applications by showing the conventions I use and , more importantly, why I choose them. That last part is important ... it's is not important to follow someone else's guidelines (including mine) as much as it is to understand why people choose what they do. I tried to share my reasons in this document to shed some light on how I think about the challenges and solutions. This has always helped me, and I hope it helps you.
What this Guide is Not
This guide is not intended to serve as a demo of reusable code, code snippets, or advanced solutions though it may drop a few here or there. Rather it is intended to be a starting point for a team looking for consistency.
Community Awesomeness and Credit
Never work in a vacuum. I find that the AngularJS community is an incredible group who are passionate about sharing experiences. As such, a friend and AngularJS expert Todd Motto and I have collaborated on many styles and conventions. We agree on most, and some we diverge. I encourage you to check out Todd's guidelines to get a sense for his approach and how it compares.
Many of my styles have been from the many pair programming sessions Ward Bell and I have had. While we don't always agree, my friend Ward's has certainly helped influence the ultimate evolution of this guide.
Here is a starting list of what is included, with more to come.
There is much more in the AngularJS Style Guide, which I will continue to update and add content to.
- Single Responsibility
- Resolving Promises for a Controller
- Manual Dependency Injection
- Minification and Annotation
- Exception Handling
- Application Structure
- Angular $ Wrapper Services
If you have questions with the guide, feel free to leave them as issues in the repo. If you find a typo, create a pull request. The idea is to keep the content up to date and use github's native feature to help tell the story with issues and PR's, which are all searchable via google. Why? Because odds are if you have a questions, someone else does too! You can learn more here at about how to contribute.
- angular (37) ,
- open source (5) ,
- patterns (11) ,
- pluralsight (51) ,
- Uncategorized (159)