【发布时间】:2016-10-29 18:04:58
【问题描述】:
在我的 SQLite cordova 插件上删除一行数小时后,我试图刷新范围内的视图,但没有运气。
代码:$scope.remove = function() {
var x = document.getElementById("name").textContent;
$cordovaSQLite.execute(db, 'DELETE from table WHERE name=?', [x])
.then(function(res) {
var index = $scope.listItems.indexOf(x);
$scope.listItems.splice(index, 1);
}, function(error) {
console.log(error.message);
})
};
删除成功,但给我留下了一个空白页面,要刷新我的 Ionic Platform 应用程序,我必须转到其他页面而不是返回。
其他代码:$scope.showConfirm = function () {
var x = document.getElementById("name").textContent;
var confirmPopup = $ionicPopup.confirm({
title: 'Deleting Journal Entry',
template: 'Are you sure you want to delete this item ?'
});
confirmPopup.then(function (res) {
if (res) {
var query = "DELETE FROM chocolates where name = ?";
$cordovaSQLite.execute(db, query, [x]);
$state.go($state.current, $stateParams, {reload: true, inherit: false});
console.log(x);
} else {
console.log('You are not sure');
};
});
};
此代码也成功删除了我数据库中的行,但刷新功能不起作用。与我必须转到其他页面并返回查看更新视图之前的代码相同。
尝试了alternative 1和alternative 2的许多答案
如果我能找到任何帮助,我将不胜感激,谢谢
【问题讨论】:
-
没有人?哦,亲爱的..碰碰!
标签: arrays angularjs sqlite cordova ionic-framework