Skip to content

Instantly share code, notes, and snippets.

@zachlysobey
Last active November 19, 2015 15:59
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zachlysobey/12ba1c10f38455133393 to your computer and use it in GitHub Desktop.
Save zachlysobey/12ba1c10f38455133393 to your computer and use it in GitHub Desktop.
Angular Resources & Best Practices

#Angular Resources & Best Practices

John Papa's Styleguide - Required reading. We try to follow this blindly.

Tips

  • The above styleguide has snippets for different editors
  • Organize directories by feature, not type
  • One Injectable "thing" per file.
  • Thin controllers. Think of them as the View Model (vm), not a MVC controller.
  • Avoid the link function and doing things with element (this isn't jQuery)
  • Business logic in Services (or Factories)
  • Unit test all the logic.
  • Use GULP for a build system

Build system Wins

  • Auto-adding
  • Concatenation of js files
  • Linting
  • LESS css preprocessor
  • ES6 Transpiliation

ES6 (ES2015)

The next iteration of JavaScript. Not all features supported in all browsers (yet) so we "transpile"

Cool stuff we get:

  • inline templates via multi-line strings
  • fat arrows functions and other sugar

Things we maybe should be doing but aren't

  • Module loader (WebPack or JSPM)

Good reading

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment