@@ -20,7 +20,7 @@ app.run(function ($http, DSCacheFactory) {
20
20
$http.defaults.cache = DSCacheFactory.get('defaultCache');
21
21
});
22
22
23
- app.service('myService', function ($http) {
23
+ app.service('myService', function ($http, $q ) {
24
24
return {
25
25
getDataById: function (id) {
26
26
var deferred = $q.defer(),
@@ -52,7 +52,7 @@ app.controller('myCtrl', function (myService) {
52
52
53
53
Tell `$http` to use a cache created by `DSCacheFactory` for a specific request:
54
54
```javascript
55
- app.service('myService', function ($http, DSCacheFactory) {
55
+ app.service('myService', function ($q, $ http, DSCacheFactory) {
56
56
57
57
DSCacheFactory('dataCache', {
58
58
maxAge: 90000, // Items added to this cache expire after 15 minutes.
@@ -91,7 +91,7 @@ app.controller('myCtrl', function (myService) {
91
91
92
92
Do your own caching while using the $http service:
93
93
```javascript
94
- app.service('myService', function ($http, DSCacheFactory) {
94
+ app.service('myService', function ($q, $ http, DSCacheFactory) {
95
95
96
96
DSCacheFactory('dataCache', {
97
97
maxAge: 900000, // Items added to this cache expire after 15 minutes.
0 commit comments