You cannot do this. But this is beautiful, you should not.
What you need to do is configure the service using the factory, to which your controllers or whatever can be accessed. A factory looks like this:
app.factory('service', ['$http', function($http) { var service = {} service.get = function() { return $http.get('/url'); } return service. }]);
Then you can enter this service in whatever you want, and you can call the get function from there, which will return a promise to you.
Edit: To clarify, you do not need to return a promise that you can use in your imagination.
source share