'use strict'; (function(){ angular.module('app') .factory('myService', myService); function myService(){ var ret = { /* ... some other stuff ... */ getData: getData, }; function getData() { //-- Angular will pass $scope as the first argument, // but we don't use it in this example return 'some value'; } /* .... */ return ret; } }());