I'm writing this code
(function () {
'use strict';
angular.module('starter.services',['ionic','ngOpenFB','angular-data.DSCacheFactory'])
.run(function($ionicPlatform, ngFB, DSCacheFactory) {
$ionicPlatform.ready(function() {
DSCacheFactory("fbLoginCache", { storageMode: "localStorage" });
});
})
.factory('profileserv', ['$http','$q','$ionicLoading','DSCacheFactory','ngFB',profileserv]);
function profileserv($http, $q, $ionicLoading, DSCacheFactory,ngFB) {
self.fbCache = DSCacheFactory.get("fbLoginCache");
function getProfile(){
//some code
}
function loginFB() {
//some code
}
function init(appid) {
var fbToken = self.fbCache.get("token");
//**here fbToken is unidentified**
// some more code
}
}
return {
getProfile: getProfile,
getLoginStatus: ngFB.getLoginStatus,
loginFB: loginFB,
init: init
};
}
})();
But fbCache.get("token") isn't returning my cache. The funny thing is that I have another module 'starter' that registers 'angular-data.DSCacheFactory' in the same way and creates the cache with DSCacheFactory in the run function and runs perfectly fine. I've tried merging this module with the 'starter' module and do all the caches creation in that .run function but I get the same error when I try to access it from this service 'profileserv'.
I know that DSCacheFactory has been renamed in the new version but i'm using the older version here, and since it's already working in the other module that shouldn't be the problem.
Here's the other module:
angular.module('starter', ['ionic', 'ngOpenFB', 'angular-data.DSCacheFactory','starter.services'])
.run(function($ionicPlatform, ngFB, DSCacheFactory, profileserv) {
$ionicPlatform.ready(function() {
//DSCacheFactory("fbLoginCache", { storageMode: "localStorage" }); // wasn't working here either
DSCacheFactory("offersDataCache", { storageMode: "localStorage", maxAge: 150000, deleteOnExpire: "aggressive" });
// ^ this one works
// more code
});
})
Could you help please?