当将我的应用程序模拟到 android 模拟器时,CordovaLog 给我一个错误,无法调用未定义的 setOptions 方法。在我的 Chrome 浏览器中我没有问题,但是当我模拟它时结果不好,不要加载我的所有视图,而是加载一部分它并不起作用。谁能告诉我如何定义 setOptions 或为什么未定义
(function () {
'use strict';
angular.module('EventList').factory('EventApi', [ '$http', '$q', '$ionicLoading', 'DSCacheFactory', EventApi]);
function EventApi($http, $q, $ionicLoading, DSCacheFactory)
{
var AllEventCache = DSCacheFactory.get("AllEventDataCache");
AllEventCache.setOptions({
onExpire: function (key, value) {
getAllEvents()
.then(function () {
console.log("Automatically refreshed");
}, function () {
console.log("Error putting Expired data");
AllEventCache.put(key, value);
});
}
});
})();
.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();
}
var AllEventCache = DSCacheFactory("AllEventDataCache", { storageMode: "localStorage", maxAge: 360000, deleteOnExpire: "aggressive" });
});
})