0
我需要像這樣調用IndexedDB庫之後返回方法對象。AngularJS IndexedDB調用後的方法返回對象
.factory('presentationData', ['$indexedDB', 'uuid4','$q', function ($indexedDB, uuid4, $q) {
var objectStore = $indexedDB.openStore('presentations', function(store) {
return store;
});
return objectStore.then(function(objectStore) {
var functions = getDefaultDataServiceFunctions(objectStore);
functions.getAll = function (includeFlaggedForDelete) {
if (includeFlaggedForDelete) {
return objectStore.getAll();
}
return objectStore.getAll().then(function (presentations) {
return presentations.filter(function (p) {
return !(p.meta && p.meta.localStatus === 'deleted');
});
});
};
functions.getWithLocalStatus = function (status) {
var query = $indexedDB.queryBuilder().$index('localStatus').$eq(status).compile();
return objectStore.each(query);
};
return functions;
})
}])
爲什麼這不返回方法的對象?我不明白!
使用這個:https://github.com/bramski/angular-indexedDB
謝謝!
如果你可以在jsfiddle中重現它,它將有助於解決你的問題。 – 6220119