单击按钮时会显示带有列表编辑的弹出窗口。单击列表中的项目时,会打开一个模型。我需要在模型打开时关闭弹出窗口,但它不起作用。
$scope.showPopup = function() {
$scope.data = {}
$scope.myPopup = $ionicPopup.show({
template: '<div class="list padding" ng-click="edit()">Edit</div>',
cssClass: 'custom-class',
scope: $scope,
});
};
$scope.hidePopup = function() {
$scope.myPopup.close();
}
$ionicModal.fromTemplateUrl('templates/modal.html', {
scope: $scope
}).then(function(modal) {
$scope.modal = modal;
});
$scope.openModal = function() {
$scope.hidePopup();
$scope.modal.show()
}
$scope.closeModal = function() {
$scope.modal.hide()
}
$scope.edit = function() {
console.log(56646);
$scope.hidePopup();
$scope.openModal();
};
$scope.update = function(item) {
$scope.closeModal
console.log(item);
}
请帮帮我?
答案 0 :(得分:1)
打开模型时需要使用$ timeout。
$scope.showPopup = function() {
$scope.data = {}
$scope.myPopup = $ionicPopup.show({
template: '<div class="list padding" ng-click="edit()">Edit</div>',
cssClass: 'custom-class',
scope: $scope,
});
};
$scope.hidePopup = function() {
$scope.myPopup.close();
}
$ionicModal.fromTemplateUrl('templates/modal.html', {
scope: $scope
}).then(function(modal) {
$scope.modal = modal;
});
$scope.openModal = function() {
$scope.hidePopup();
$scope.modal.show()
}
$scope.closeModal = function() {
$scope.modal.hide()
}
$scope.edit = function() {
console.log(56646);
$scope.hidePopup();
$timeout(function(){
$scope.openModal();
})
};
$scope.update = function(item) {
$scope.closeModal
console.log(item);
}