code: function() {
      var d = new Deferred();
      //Necessary to support unbound execution :/
      d.resolve = simpleBind(d, d.resolve);
      d.reject = simpleBind(d, d.reject);
      d.notify = simpleBind(d, d.notify);
      return d;
    }
docs: @ngdoc method
  @name ng.$q#defer
  @kind function
  
  @description
  Creates a `Deferred` object which represents a task which will finish in the future.
  
  @returns {Deferred} Returns a new instance of deferred.