angular.module('app', []); angular.module('app').controller('myController', [ '$scope', 'myService', function($scope, myService) { myService.getUsers().then(function(users) { $scope.users = users; }); } ]); angular.module('app').provider('myService', function() { var users; this.setUsers = function(u) { users = u; } this.$get = ['$q', function($q) { return { getUsers: function() { return $q.when(users); } }; }]; }); angular.module('app').config([ 'myServiceProvider', function(myServiceProvider) { myServiceProvider.setUsers([{login: 'login1'}]); } ]);