 <p>A pattern I use for such a thing looks like this…</p> <p>Factory code…</p> <pre><code>angular.module('myApp').factory('MyFactory', function () { var myVar; function MyFactory(param) { myVar = param; this.hello = hello; } function hello() { console.log('Hello ' + myVar); } return MyFactory; }); </code></pre> <p>Then when using the factory and needing to pass parameters…</p> <pre><code>angular.module(‘myApp’).controller(‘MyController’ function(MyFactory) { myFactory = new MyFactory(‘world’); myFactory.hello(); }); </code></pre>