title: What are "decorators" and how are they used?
body: <p>I'm curious what exactly decorators are in AngularJS. There isn't much information online for decorators save for a blurb in the <a href="http://docs.angularjs.org/api/AUTO.$provide#decorator" rel="noreferrer">AngularJS documentation</a> and a brief (albeit interesting) mention in a <a href="http://www.youtube.com/watch?v=VxuN6WO3tIA" rel="noreferrer">youtube video</a>.</p>
  
  <p>As the Angular guys put it a decorator is:</p>
  
  <blockquote>
    <p>Decoration of service, allows the decorator to intercept the service
    instance creation. The returned instance may be the original instance,
    or a new instance which delegates to the original instance.</p>
  </blockquote>
  
  <p>I don't really know what that <em>means</em>, and I'm not sure why you would separate this logic from the service itself. For example if I wanted to return something different under different conditions I would just pass different arguments to the relevant functions or use another function sharing that private state.</p>
  
  <p>I'm still kind of an AngularJS noob so I'm sure it's just ignorance and/or bad habits I've picked up.</p>