DSCacheFactory.get 不工作
DSCacheFactory.get not working
我使用了一个基本示例 angular 缓存但是出现了这个错误
angular.module("eliteApp",["ionic","angular-data.DSCacheFactory"])
.run(function($ionicPlatform , DSCacheFactory) {
$ionicPlatform.ready(function() {
// Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
// for form inputs)
if (window.cordova && window.cordova.plugins.Keyboard) {
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
}
if (window.StatusBar) {
// org.apache.cordova.statusbar required
StatusBar.styleDefault();
}
DSCacheFactory("leagueDataCache", { storageMode: "localStorage", maxAge: 5000, deleteOnExpire: "aggressive" });
DSCacheFactory("leaguesCache", { storageMode: "localStorage", maxAge: 5000, deleteOnExpire: "aggressive" });
DSCacheFactory("myTeamsCache", { storageMode: "localStorage" });
DSCacheFactory("staticCache", { storageMode: "localStorage" });
});
})
.factory('eliteApi',['$http','$q', '$ionicLoading','$timeout','DSCacheFactory', function( $http , $q , $ionicLoading , DSCacheFactory ,$timeout ) {
var currentLeagueId;
self.leagueDataCache = DSCacheFactory.get("leagueDataCache");
self.leaguesCache = DSCacheFactory.get("leaguesCache");
<script src="lib/lodash/dist/lodash.min.js"></script>
<script src="lib/angular-cache/dist/angular-cache.min.js"></script>
<script src="cordova.js"></script>
不知道function get的问题我也不知道为什么self.leagueDataCache = DSCacheFactory.get("leagueDataCache");
self.leaguesCache = DSCacheFactory.get("leaguesCache");
你的问题是这一行
.factory('eliteApi',['$http','$q', '$ionicLoading','$timeout','DSCacheFactory', function( $http , $q , $ionicLoading , DSCacheFactory ,$timeout ) {
您需要按照在函数中使用它们的顺序声明注入的模块。
$http => $http
$q=> $q
$ionicLoading=> $ionicLoading
$timeout=> DSCacheFactory
DSCacheFactory=> $timeout
所以你实际上是在尝试使用 $timeout 的 get 函数,它不存在。
Grüße ausm Allgäu!
我使用了一个基本示例 angular 缓存但是出现了这个错误
angular.module("eliteApp",["ionic","angular-data.DSCacheFactory"])
.run(function($ionicPlatform , DSCacheFactory) {
$ionicPlatform.ready(function() {
// Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
// for form inputs)
if (window.cordova && window.cordova.plugins.Keyboard) {
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
}
if (window.StatusBar) {
// org.apache.cordova.statusbar required
StatusBar.styleDefault();
}
DSCacheFactory("leagueDataCache", { storageMode: "localStorage", maxAge: 5000, deleteOnExpire: "aggressive" });
DSCacheFactory("leaguesCache", { storageMode: "localStorage", maxAge: 5000, deleteOnExpire: "aggressive" });
DSCacheFactory("myTeamsCache", { storageMode: "localStorage" });
DSCacheFactory("staticCache", { storageMode: "localStorage" });
});
})
.factory('eliteApi',['$http','$q', '$ionicLoading','$timeout','DSCacheFactory', function( $http , $q , $ionicLoading , DSCacheFactory ,$timeout ) {
var currentLeagueId;
self.leagueDataCache = DSCacheFactory.get("leagueDataCache");
self.leaguesCache = DSCacheFactory.get("leaguesCache");
<script src="lib/lodash/dist/lodash.min.js"></script>
<script src="lib/angular-cache/dist/angular-cache.min.js"></script>
<script src="cordova.js"></script>
不知道function get的问题我也不知道为什么self.leagueDataCache = DSCacheFactory.get("leagueDataCache");
self.leaguesCache = DSCacheFactory.get("leaguesCache");
你的问题是这一行
.factory('eliteApi',['$http','$q', '$ionicLoading','$timeout','DSCacheFactory', function( $http , $q , $ionicLoading , DSCacheFactory ,$timeout ) {
您需要按照在函数中使用它们的顺序声明注入的模块。
$http => $http
$q=> $q
$ionicLoading=> $ionicLoading
$timeout=> DSCacheFactory
DSCacheFactory=> $timeout
所以你实际上是在尝试使用 $timeout 的 get 函数,它不存在。
Grüße ausm Allgäu!