gpt4 book ai didi

javascript - DSCacheFactory.get 不工作

转载 作者:行者123 更新时间:2023-12-03 10:13:20 25 4
gpt4 key购买 nike

我使用基本示例 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>

它不知道函数 get 的问题我不知道为什么我 self.leagueDataCache = DSCacheFactory.get("leagueDataCache");
self.leaguesCache = DSCacheFactory.get("leaguesCache");

最佳答案

你的问题是这一行

.factory('eliteApi',['$http','$q', '$ionicLoading','$timeout','DSCacheFactory', function( $http , $q , $ionicLoading , DSCacheFactory ,$timeout ) {

您需要按照在函数中使用它们的顺序声明注入(inject)的模块。

$http => $http

$q=> $q

$ionicLoading=> $ionicLoading

$timeout=> DSCacheFactory

DSCacheFactory=> $timeout

所以你实际上是在尝试使用 $timeout 的 get 函数,而该函数并不存在。

Grüße ausm Allgäu!

关于javascript - DSCacheFactory.get 不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30009339/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com