Return an angular $resource from a factory after an asynchronous function call.
Below shows an example of an angular factory in which I'm attempting to return a $resource.
I'm trying to make an asynchronous function call using another service to receive the web service path before returning the $resource.
Is this possible?
angular.module('app').factory('newService', function($resource, configService) {
    configService.get(function(config) {
         return $resource(config.webServicePath + '/api/names', {},
             { 'update': { method:'PUT' } }
         );
    });
});
Would anybody have an example of either a service, provider, or factory returning a resource after an asynchronous function call to receive information like above.
It would also be helpful if you could provide an example of the newService being used in a controller.
Thanks in advance for the help.
$q, see docs.angularjs.org/api/ng/service/$q. Most angular requests return promises already.