I've inherited the following code, and I need to get $resource injected into the service. I'm new to AngularJS and not finding the documentation very helpful. Everything I've tried has failed. Any ideas?
(function (angular) {
angular.module('myModule')
.provider('myService', [myServiceProvider]);
function myServiceProvider() {
...
}
Thanks.
You don't have access to the dependencies inside provider function because run at config phase. You could get them available by injecting $injector service inside your provider function.
But better and cleaner way would be just inject dependency inside it inside provider
$get
function directly.Code