Q:

Installing ngResource in Factory

I am trying to install ngResource into a factory like so:
'use strict';
var DTapp = angular.module('DeviceTraining');
/* Services */

DTapp.factory('Slides', ['ngResource', function($resource) {
    return $resource('slides/:slideID.json', {}, {
        query: {method:'GET', params:{slideID:'slides'}, isArray: true}
    });
}]);

But I am getting this error message:
Error: [$injector:unpr] Unknown provider: ngResourceProvider <- ngResource <- Slides

Any help?

A:

That's not how you install modules. You include ngResource in your module and inject $resource into your factory:
var DTapp = angular.module('DeviceTraining', ['ngResource']);
DTapp.factory('Slides', ['$resource', function ($resource) {
   // ...
}]);

