Skip to content
Dean Sofer edited this page Aug 26, 2013 · 21 revisions
  • Namespace distributed code
    This means using bs- or ui- or something. You could use your initials if you want but you may find it becomes more meaningful if you prefix code by relevant grouping breakdowns (such as loc- for location services or i18n- for translation)
  • Only use .$broadcast(), .$emit() and .$on() for atomic events
    This means events that are relevant globally across the entire app (such as a user authenticating or the app closing). If you want events specific to modules, services or widgets you should consider Services, Directive Controllers, or 3rd Party Libs
  • Support {{}} in all string attributes using $attrs.$observe()
    When building a directive that supports string-value-only attributes, always allow the user to provide expressions, like ng-href and ng-src.
  • Extend directives by using Directive Controllers
    You can place methods and properties into a directive-controller, and access that same controller from other directives. You can even override methods and properties through this relationship

Clone this wiki locally