title: AngularJS factory mixins
body: <p>I've seen some examples where methods are added to the AngularJS controller as mixins.
  For example:</p>
  
  <pre><code>(function () {
    var app = angular.module('angularjs-starter', []);
  
    var ParentCtrl = function ($scope, $location) {
      $scope.path = function () {
        return $location.absUrl();
      };
    };
  
    app.controller('ChildCtrl', function($scope, $injector) {
      $injector.invoke(ParentCtrl, this, {$scope: $scope});
      $scope.url = $scope.path();
    });
  })();
  </code></pre>
  
  <p>I want to be able to add new methods as a 'mixin' to a factory.
  How can I do that?  It's not possible to pass $scope into a factory.</p>
  
  <p>For example, the following doesn't work:</p>
  
  <pre><code>var serv = angular.module('myModule', [])
  
  serv.factory('myService', ['$scope', '$injector', function ($scope, $injector) {
  ...
  </code></pre>